Assign a nullptr to a std::string is safe?

Interesting little question. According to the C++11 standard, sect. 21.4.2.9, basic_string(const charT* s, const Allocator& a = Allocator()); Requires: s shall not be a null pointer. Since the standard does not ask the library to throw an exception when this particular requirement is not met, it would appear that passing a null pointer provoked undefined … Read more

Why is there no transform_if in the C++ standard library?

The standard library favours elementary algorithms. Containers and algorithms should be independent of each other if possible. Likewise, algorithms that can be composed of existing algorithms are only rarely included, as shorthand. If you require a transform if, you can trivially write it. If you want it /today/, composing of ready-mades and not incur overhead, … Read more