std::back_i...ert_iterator(3)
π NAME
std::back_insert_iterator::back_insert_iterator β bestie, it's the constructor of std::back_insert_iterator, and yes the name really does just say itself twice like that. Iconic of it.
Coming at you from the C++ Standard Libary manual (yes that's how it's spelled on the tin, we don't fix it, we respect it π«Ά).
β¨ Synopsis β¨
explicit back_insert_iterator( Container& c ); (until C++20)
constexpr explicit back_insert_iterator( Container& c ); (since C++20)
So what does it actually do? It initializes the underlying pointer to the container to std::addressof(c). That's it. That's the whole personality. β¨
π Parameters π
cβ the container you're initializing the inserter with. Your main character container, if you will.
π¦ Defect reports π¦
Okay so real talk β the following behavior-changing defect reports were applied retroactively to previously published C++ standards. Like, they went back and edited the canon. History was rewritten, no cap.
- DR:
P2325R3 - Applied to: C++20
- Behavior as published: default constructor was provided as along with the requirement iterators must be default_initializable
- Correct behavior: removed
So yeah, the default constructor got removed π. It's giving "we're so sorry for the confusion."
πΈ Sign-off πΈ
This little gem lives over at http://cppreference.com, version 2024.06.10, and it's filed under std::back_i...ert_iterator(3) β yes the title is truncated with ellipsis in the corner of the page, we don't know why either, it's just the vibe π
π mwah, go construct something cute πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms