diff --git a/src/lib/meta/function-erasure.hpp b/src/lib/meta/function-erasure.hpp index b5299d186..460143baf 100644 --- a/src/lib/meta/function-erasure.hpp +++ b/src/lib/meta/function-erasure.hpp @@ -99,19 +99,18 @@ namespace typelist{ { typedef bool (T::*ValidityCheck)() const; typedef ValidityCheck _unspecified_bool_type; - ValidityCheck isValid; - - BoolCheckable() : isValid (&T::isValid) {} /** implicit conversion to "bool" */ operator _unspecified_bool_type() const ///< never throws { + ValidityCheck isValid (&T::isValid); T const& obj = static_cast (*this); return (obj.*isValid)()? isValid : 0; } bool operator! () const ///< never throws { + ValidityCheck isValid (&T::isValid); T const& obj = static_cast (*this); return !(obj.*isValid)(); } diff --git a/src/tool/try.cpp b/src/tool/try.cpp index f4e6e1a4f..f2496df9c 100644 --- a/src/tool/try.cpp +++ b/src/tool/try.cpp @@ -49,7 +49,7 @@ using boost::format; bool isValid() const { - return true; + return val_ % 2; } }; @@ -61,16 +61,20 @@ main (int, char**) //(int argc, char* argv[]) { NOBUG_INIT; - - TestIt1 testrosteron (22); - bool boo = testrosteron; + for (int i=0; i<10; ++i) + { + TestIt1 testrosteron (i); + + if (testrosteron) + cout << "doIt \n"; + if (!testrosteron) + cout << i << "\n"; + } + cout << "size=" << sizeof(TestIt1) <<"\n"; + cout << "\n.gulp.\n"; - if (boo) - cout << "size=" << sizeof(TestIt1) <<"\n"; - - return 0; }