Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73956 - sandbox/enums/libs/enums/test
From: vicente.botet_at_[hidden]
Date: 2011-08-20 14:26:44


Author: viboes
Date: 2011-08-20 14:26:44 EDT (Sat, 20 Aug 2011)
New Revision: 73956
URL: http://svn.boost.org/trac/boost/changeset/73956

Log:
Enums: add test on const char* conversions
Text files modified:
   sandbox/enums/libs/enums/test/EnumClass.cpp | 9 ++++++++-
   1 files changed, 8 insertions(+), 1 deletions(-)

Modified: sandbox/enums/libs/enums/test/EnumClass.cpp
==============================================================================
--- sandbox/enums/libs/enums/test/EnumClass.cpp (original)
+++ sandbox/enums/libs/enums/test/EnumClass.cpp 2011-08-20 14:26:44 EDT (Sat, 20 Aug 2011)
@@ -18,6 +18,8 @@
 #include "./f.hpp"
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/enums/enum_subrange_traiter.hpp>
+#include <boost/conversion/is_extrinsically_explicitly_convertible.hpp>
+#include <boost/static_assert.hpp>
 
 #define RUN_TIME
 #define COMPILE_TIME
@@ -29,10 +31,15 @@
   using namespace boost::enums;
 
   std::cout << __LINE__ << std::endl;
+ BOOST_STATIC_ASSERT(( boost::conversion::is_extrinsically_explicitly_convertible< const char*, EnumClass >::value));
+ BOOST_STATIC_ASSERT(( boost::conversion::is_extrinsically_explicitly_convertible< std::string, EnumClass >::value));
 
   { // The wrapper can be constructed from a valid const char* representation
- EnumClass e = explicit_convert_to<EnumClass>("Enum2");
+ std::string str="Enum2";
+ EnumClass e = boost::conversion::explicit_convert_to<EnumClass>(str);
     BOOST_TEST(e==EnumClass::Enum2);
+ EnumClass e2 = boost::conversion::explicit_convert_to<EnumClass>("Enum2");
+ BOOST_TEST(e2==EnumClass::Enum2);
   }
 #ifdef COMPILE_TIME2
   { // Construction of the wrapper from const char * compile fails


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk