* \ingroup g_CRTP
*/
template <class Derived>
- class IdStringType : protected sat::detail::PoolMember,
- private base::SafeBool<Derived>
+ class IdStringType : protected sat::detail::PoolMember
{
- typedef typename base::SafeBool<Derived>::bool_type bool_type;
public:
typedef IdString::IdType IdType;
const Derived & self() const { return *static_cast<const Derived*>( this ); }
public:
- const IdString & idStr() const { return self()._str; }
+ IdString idStr() const { return self()._str; }
bool empty() const { return idStr().empty(); }
unsigned size() const { return idStr().size(); }
IdType id() const { return idStr().id(); }
public:
-#ifndef SWIG // Swig treats it as syntax error
/** Evaluate in a boolean context <tt>( ! empty() )</tt>. */
- using base::SafeBool<Derived>::operator bool_type;
-#endif
+ explicit operator bool() const
+ { return ! empty(); }
+
+ /** Explicit conversion to IdString */
+ explicit operator IdString() const
+ { return idStr(); }
+
+ /** Explicit conversion to std::string */
+ explicit operator std::string() const
+ { return asString(); }
+
public:
// - break it down to idString/const char* <=> idString/cont char*
// - handle idString(0)/NULL being the least value
if ( ! lhs ) return rhs ? -1 : 0;
return rhs ? ::strcmp( lhs, rhs ) : 1;
}
-
- private:
-#ifndef SWIG // Swig treats it as syntax error
- friend base::SafeBool<Derived>::operator bool_type() const;
-#endif
- bool boolTest() const { return ! empty(); }
};
///////////////////////////////////////////////////////////////////