から、 要素型が U 型のアロケータ型 B を生成 (std::allocator<T> ⇒ std::allocator<U> みたいな感じ) using B = typename A::rebind<U>::other; ホントは using B = std::allocator_traits<A>::rebind_alloc<U>
の first と second をそれぞれうまい具合に uses-allocator 構築する template<class T1, class T2, class... Args1, class... Args2> void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y); template<class T1, class T2> void construct(pair<T1, T2>* p); template<class T1, class T2, class U, class V> void construct(pair<T1, T2>* p, U&& x, V&& y); template<class T1, class T2, class U, class V> void construct(pair<T1, T2>* p, const pair<U, V>& pr); template<class T1, class T2, class U, class V> void construct(pair<T1, T2>* p, pair<U, V>&& pr);
T1, class T2> bool operator==(const polymorphic_allocator<T1>& a, const polymorphic_allocator<T2>& b) noexcept; // アロケータの比較。*a.resource() != *b.resource() の結果を返すだけ。 template<class T1, class T2> bool operator!=(const polymorphic_allocator<T1>& a, const polymorphic_allocator<T2>& b) noexcept;
A visitor’s guide to C++ allocators by Thomas Köppe アロケータの詳細がまとめられた非常に良い記事 カスタムアロケータやオフセットポインターのサンプル実装へのリンクもある https://rawgit.com/google/cxx-std-draft/allocator-paper/allocator_user_guide.html D0773R1 Towards meaningful fancy pointers ファンシーポインタとその適用限界について考察した非常に良い記事 https://quuxplusone.github.io/draft/fancy-pointers.html 勉強会後に 追記
Good Parts” https://www.youtube.com/watch?v=v3dz-AKOVL8 Alisdair Meredith “An allocator model for std2” https://www.youtube.com/watch?v=oCi_QZ6K_qk John Lakos “Local ('Arena') Memory Allocators (part 1 of 2)” https://www.youtube.com/watch?v=nZNd5FjSquk John Lakos “Local ('Arena') Memory Allocators (part 2 of 2)” https://www.youtube.com/watch?v=CFzuFNSpycI Bob Steagall “How to Write a Custom Allocator” https://www.youtube.com/watch?v=kSWfushlvB8 勉強会後に 追記