I just stumbled around in the STL for C++ and found a quite surprising exception in the vector header.
Cleaned up from some unnecessary junk it boils down to this:
(This snippets could be found in the vector class within the STL vector header)
template<typename... _Args>
reference emplace_back(_Args&&... __args) {
push_back(bool(__args...));
return back();
}
void push_back(bool __x) {
if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr())
*this->_M_impl._M_finish++ = __x;
else
_M_insert_aux(end(), __x);
}
As already outlined in the title, I'm quite surprised by the bool(__args...) expression which makes no sense for me at all.
I hope somebody could bring light into the darkness and help me out.
Edit: Answered, I was a bit lazy
Solution found, I was a bit lazy.
I used my IDEs method resolver to jump to the declaration.
But sadly it directed me to the stl_bvector.h header and the given method above.
Since it seems that this header only handles the implementation for std::vector<bool> the code makes much more sense.