, , , transform - .
, , , std::replace_copy_if, ( ) .
Qt, , QVariant QString std::vector<std::string>, , Qt.
#include <vector>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <string>
int main() {
std::vector<std::string> input { "one", "two", "", "three" };
std::vector<std::string> output;
std::replace_copy_if(input.begin(), input.end(),
std::back_inserter(output),
[](std::string const &s) { return s.empty(); },
"NONE");
std::copy(output.begin(), output.end(),
std::ostream_iterator<std::string>(std::cout, "\n"));
}
NONE, ( , isNull , ).
, , , :
one
two
NONE
three
, , . , , () input.begin(), input.end() input. , -, , D, , , , ( ).
, range, : Boost Range , ( , ) Eric Neibler.