format icon indicating copy to clipboard operation
format copied to clipboard

Allocate member variables with custom allocator

Open quantumwizard opened this issue 5 years ago • 4 comments

member std::vector variables should use template parameter Allocator instead of default std::allocator

quantumwizard avatar May 29 '20 06:05 quantumwizard

This shouldn't work; because std::vector requires it's allocator's value_type to match the value_type of the vector. libc++, for example, will static_assert to check this.

mclow avatar May 29 '20 14:05 mclow

@mclow I made changes to rebind the allocator for the correct types

quantumwizard avatar May 29 '20 16:05 quantumwizard

Codecov Report

Merging #76 into develop will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #76   +/-   ##
========================================
  Coverage    64.33%   64.33%           
========================================
  Files           10       10           
  Lines          816      816           
  Branches       290      290           
========================================
  Hits           525      525           
  Misses         125      125           
  Partials       166      166           
Impacted Files Coverage Δ
include/boost/format/format_class.hpp 87.50% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5884c3d...a561501. Read the comment docs.

codecov[bot] avatar May 29 '20 17:05 codecov[bot]

That's better. I will give this a try (and probably commit it), but this is not even close to right. (the code, not the patch).

There's no provision for actually supplying an allocator to this class. It's all "default construct" everywhere. This works great for stateless allocators, but not so well for stateful ones.

mclow avatar May 29 '20 18:05 mclow