title: AllocatorAwareContainer and copy-and-swap idiom
body: <p>I'm trying to learn data structures along with idiomatic C++ and because of stuff like this I feel like it's probably not the best way to learn either. Let's say I wanted to implement a dynamic array class which would meet the <em>Container</em>, <em>ReversibleContainer</em> and <em>AllocatorAwareContainer</em> named requirements.</p>
  
  <p>The <a href="https://en.cppreference.com/w/cpp/named_req/AllocatorAwareContainer" rel="nofollow noreferrer">cppreference</a> page on <em>AllocatorAwareContainer</em> says:</p>
  
  <blockquote>
    <p>The only way to replace an allocator is copy-assignment,
    move-assignment, and swap:</p>
    
    <ol>
    <li>Copy-assignment will replace the allocator only if <code>std::allocator_traits&lt;allocator_type&gt;::propagate_on_container_copy_assignment::value</code>
    is <code>true</code></li>
    <li>Move-assignment will replace the allocator only if <code>std::allocator_traits&lt;allocator_type&gt;::propagate_on_container_move_assignment::value</code>
    is <code>true</code></li>
    <li>Swap will replace the allocator only if <code>std::allocator_traits&lt;allocator_type&gt;::propagate_on_container_swap::value</code>
    is <code>true</code>. Specifically, it will exchange the allocator instances
    through an unqualified call to the non-member function swap, see
    Swappable.</li>
    </ol>
    
    <p>Note: swapping two containers with unequal allocators if
    <code>propagate_on_container_swap</code> is <code>false</code> is undefined behavior.</p>
  </blockquote>
  
  <p>What if I implement both of those assignment operators using copy-and-swap idiom? I mean, there aren't that many ways to check <code>propagate_on_container_copy_assignment</code> and <code>propagate_on_container_move_assignment</code> if they are expressed in terms of move/copy constructor and a swap function. Is it safe to assume that when <code>propagate_on_container_swap</code> is true, the remaining two are true as well?</p>