[PATCH] D48753: [libcxx] Use custom allocator's `construct` in C++03 when available.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 3 21:09:14 PDT 2018


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp:60
+
+  void construct(pointer p, const value_type& val)
+  {
----------------
Per my comments on D48342, I think it would be fun to add a test allocator like
```
struct cpp03_fun_allocator : bare_allocator<T> {
    ...
    void construct(pointer p, const value_type& val) {
        construct(p, val, std::is_class<T>{});
    }
    void construct(pointer p, const value_type& val, std::true_type) {
        ::new(p) value_type(val);
    }
    void construct(pointer p, const value_type& val, std::false_type) {
        ::new(p) value_type(val);
    }
```
and just see whether it passes the test suite. If it does, might as well add that test. But if it doesn't, *I'm* not going to force anyone to fix it. Allocators in C++03 seems like masochism to me. :)


https://reviews.llvm.org/D48753





More information about the cfe-commits mailing list