
AMDG Olaf wrote:
That's correct. If it contains a double the string value is empty.
The variant cannot contain a string that is not "NA"
struct available : public boost::static_visitor<bool> { bool operator()( const double&) const { return true; }
bool operator()( const string& lhs) const { assert(lhs == "NA");
return false; //??? } };
May this work? There is always a string - empty or holding "NA".
I don't quite understand. variant<double, string> holds either a double or a string at any one time, never both. If the variant holds a double then the overload of operator() for double will be called, if a string then the overload for string will be called instead. In Christ, Steven Watanabe