MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / istream_helper

Function istream_helper

src/ifcgeom/ConversionSettings.cpp:4–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3template <typename T>
4void istream_helper(std::istream& in, T& vs) {
5 std::string tokens;
6 in >> tokens;
7 std::vector<std::string> strs;
8 boost::split(strs, tokens, boost::is_any_of(","));
9 for (auto& s : strs) {
10 if constexpr (std::is_same_v<std::decay_t<T>, std::set<std::string>>) {
11 vs.insert(s);
12 } else if constexpr (std::is_same_v<std::decay_t<T>, std::set<int>>) {
13 vs.insert(boost::lexical_cast<typename T::value_type>(s));
14 } else if constexpr (std::is_same_v<std::decay_t<T>, std::vector<double>>) {
15 vs.push_back(boost::lexical_cast<typename T::value_type>(s));
16 }
17 }
18}
19
20std::istream& std::operator>>(istream& in, set<int>& ints) {
21 istream_helper<std::set<int>>(in, ints);

Callers

nothing calls this directly

Calls 3

push_backMethod · 0.80
splitFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected