samedi 29 septembre 2018

Why does `std::allocator_traits` need `construct` while placement new is enough?

According to cppreference, std::allocator_traits::construct just calls placement new by default. I cannot imagine any practical reason to use the former rather than the latter.

My questions are:

  1. Why does std::allocator_traits need construct while placement new is enough?
  2. Is there any use case showing the former has obvious advantages over the latter?

Aucun commentaire:

Enregistrer un commentaire