$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r69549 - sandbox/enums/boost/enums
From: vicente.botet_at_[hidden]
Date: 2011-03-04 12:22:34
Author: viboes
Date: 2011-03-04 12:22:30 EST (Fri, 04 Mar 2011)
New Revision: 69549
URL: http://svn.boost.org/trac/boost/changeset/69549
Log:
Enums: temporary Fix for constexpr enum_set 
+ Add static_cast to remove warnings
+ Change the condition of enum class comparison inclusion
Text files modified: 
   sandbox/enums/boost/enums/emulation.hpp |    94 ++++++++++++++++----------------------- 
   sandbox/enums/boost/enums/enum_set.hpp  |    37 ++++++++-------                         
   2 files changed, 59 insertions(+), 72 deletions(-)
Modified: sandbox/enums/boost/enums/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulation.hpp	(original)
+++ sandbox/enums/boost/enums/emulation.hpp	2011-03-04 12:22:30 EST (Fri, 04 Mar 2011)
@@ -25,46 +25,25 @@
 #define BOOST_NO_UNDERLYING_TYPE
 #define BOOST_ENUMS_USE_CONSTRUCTORS 1
 
-
-#if 0
-      BOOST_PP_IF(CONS,                             \
-        BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT),    \
-        BOOST_PP_EMPTY                            \
-      )()                                             \
-      BOOST_PP_IF(CONV,                             \
-        BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT),     \
-        BOOST_PP_EMPTY                              \
-      )()                                             \
-
+#ifndef BOOST_NO_SCOPED_ENUMS
+  #if defined(__GNUC__) &&  (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ == 5 && __GNUC_PATCHLEVEL__ < 1))
+    #define BOOST_NO_SCOPED_ENUMS_COMPARE
+  #else
+  #endif
+#else
 #endif
 
 
+
 #ifndef BOOST_NO_SCOPED_ENUMS
-  #if defined(__GNUC__) &&  (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 ))
-  
     #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP)        \
       inline bool operator OP(EC lhs, EC rhs) {                              \
         return (boost::enums::underlying_type<EC>::type)(lhs)         \
         OP                                                            \
         (boost::enums::underlying_type<EC>::type)(rhs);               \
-      }                                                               
-      #if 0
-      bool operator OP(boost::enums::enum_type<EC>::type lhs, EC rhs) {                            \
-        return lhs OP                                                 \
-        (boost::enums::underlying_type<EC>::type)(rhs);               \
-      }                                                               \
-      bool operator OP(EC lhs, type rhs) {                            \
-        return (boost::enums::underlying_type<EC>::type)(lhs) OP rhs; \
-      }    
-      #endif                       
-                        
-  #else
-  
-    #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP)
+      }
 
-  #endif
- 
-#else
+#else // BOOST_NO_SCOPED_ENUMS
 
   #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP)  \
       friend inline bool operator OP(EC lhs, EC rhs) {           \
@@ -75,9 +54,15 @@
       }                                                   \
       friend inline bool operator OP(EC lhs, type rhs) {         \
         return lhs.get() OP rhs;                          \
-      }                                             
-  
-#endif
+      }
+
+#endif // BOOST_NO_SCOPED_ENUMS
+
+#if !defined(BOOST_NO_SCOPED_ENUMS) && ! defined(BOOST_NO_SCOPED_ENUMS_COMPARE)
+
+#define BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
+
+#else // !defined(BOOST_NO_SCOPED_ENUMS) && ! defined(BOOST_NO_SCOPED_ENUMS_COMPARE)
 
 #define BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)  \
       BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, ==)      \
@@ -87,7 +72,8 @@
       BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, >)       \
       BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, >=)
 
-      
+#endif // !defined(BOOST_NO_SCOPED_ENUMS) && ! defined(BOOST_NO_SCOPED_ENUMS_COMPARE)
+
 #ifndef BOOST_NO_SCOPED_ENUMS
 
   #ifdef BOOST_NO_UNDERLYING_TYPE
@@ -126,10 +112,8 @@
       , boost::dummy::type_tag<boost::enums::underlying_type<EC>::type> const& \
     )                                                                         \
     {                                                                         \
-      return (boost::enums::underlying_type<EC>::type)(boost::enums::get_value(v) );  \
-    }                                                                         
-      
-
+      return static_cast<boost::enums::underlying_type<EC>::type>(boost::enums::get_value(v) );  \
+    }
 
   #define BOOST_ENUM_CLASS_START(EC, UT)            \
     enum class EC : UT
@@ -164,8 +148,8 @@
 #else // BOOST_NO_SCOPED_ENUMS
 
   #define BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)   \
-    EC() : val_(type())  {  }                             \
-    EC(type v) : val_(v)  {  }
+    EC() : val_(static_cast<underlying_type>(type()))  {  }                             \
+    EC(type v) : val_(static_cast<underlying_type>(v))  {  }
 
   #define BOOST_ENUMS_DETAIL_CONSTRUCTORS_AUX()    \
     BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)
@@ -188,7 +172,7 @@
     public:                                         \
       enum type
 
-  #define BOOST_ENUMS_END_1(EC, UT)                 \
+  #define BOOST_ENUMS_DETAIL_END_1(EC, UT)                 \
       ;                                             \
       typedef UT underlying_type;                   \
     private:                                        \
@@ -221,18 +205,18 @@
     )                                                                         \
     {                                                                         \
       return boost::enums::get_value(v);                                              \
-    }     
-      
+    }
+
 
-  #define BOOST_ENUMS_END_2(EC, UT)                 \
+  #define BOOST_ENUMS_DETAIL_END_2(EC, UT)                 \
       EC& operator =(type rhs) {                    \
-        val_=rhs;                                   \
+        val_=static_cast<underlying_type>(rhs);                                   \
         return *this;                               \
       }                                             \
       static EC default_value()                     \
       {                                             \
         EC res;                                     \
-        res.val_=EC::type();                 \
+        res.val_=static_cast<underlying_type>(EC::type());                 \
         return res;                                 \
       }                                             \
       static EC convert_to(underlying_type v)       \
@@ -244,7 +228,7 @@
       static EC convert_to(type v)                  \
       {                                             \
         EC res;                                     \
-        res.val_=v;                                 \
+        res.val_=static_cast<underlying_type>(v);                                 \
         return res;                                 \
       }                                             \
       type get() const                              \
@@ -256,24 +240,24 @@
     BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT)
 
   #define BOOST_ENUM_CLASS_END(EC, UT)              \
-    BOOST_ENUMS_END_1(EC, UT)                       \
-    BOOST_ENUMS_END_2(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_1(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_2(EC, UT)                       \
 
   #define BOOST_ENUM_TYPE_END(EC, UT)               \
-    BOOST_ENUMS_END_1(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_1(EC, UT)                       \
     BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT)          \
-    BOOST_ENUMS_END_2(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_2(EC, UT)                       \
 
   #define BOOST_ENUM_CLASS_CONS_END(EC, UT)         \
-    BOOST_ENUMS_END_1(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_1(EC, UT)                       \
     BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)         \
-    BOOST_ENUMS_END_2(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_2(EC, UT)                       \
 
   #define BOOST_ENUM_TYPE_CONS_END(EC, UT)          \
-    BOOST_ENUMS_END_1(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_1(EC, UT)                       \
     BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)         \
     BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT)          \
-    BOOST_ENUMS_END_2(EC, UT)                       \
+    BOOST_ENUMS_DETAIL_END_2(EC, UT)                       \
 
 #endif // BOOST_NO_SCOPED_ENUMS
 #endif
Modified: sandbox/enums/boost/enums/enum_set.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_set.hpp	(original)
+++ sandbox/enums/boost/enums/enum_set.hpp	2011-03-04 12:22:30 EST (Fri, 04 Mar 2011)
@@ -30,7 +30,7 @@
 namespace boost {
   namespace enums {
 
-    template<typename enum_type, 
+    template<typename enum_type,
              typename traits=enum_traits<enum_type> >
     class enum_set
     {
@@ -38,7 +38,10 @@
       BOOST_CONSTEXPR enum_set()
       {
       }
-      BOOST_CONSTEXPR explicit enum_set(enum_type setting)
+      //~ BOOST_CONSTEXPR
+      // Need to be refactored to be a constexpr
+      //~ error: constexpr constructor does not have empty body
+      explicit enum_set(enum_type setting)
       {
         set(setting);
       }
@@ -64,7 +67,7 @@
         : bits(str,n, zero, one)
       {}
       #endif
-      
+
       enum_set &operator&=(const enum_set &rhs)
       {
         bits &= rhs.bits;
@@ -157,7 +160,7 @@
       {
         return bits.none();
       }
-      enum_set operator<<(std::size_t pos) const 
+      enum_set operator<<(std::size_t pos) const
       {
         enum_set r = *this;
         r <<= pos;
@@ -171,27 +174,27 @@
       }
 
     private:
-      
+
       static std::size_t to_bit(enum_type value)
       {
         return traits::pos(value);
       }
-      
+
       std::bitset<traits::size> bits;
-      
+
     public:
-      
+
       std::bitset<traits::size+1> detail_bits() { return bits; }
     };
 
     // enum_set operators:
-    template <typename enum_type, typename traits> 
+    template <typename enum_type, typename traits>
     enum_set<enum_type,traits> operator&(const enum_set<enum_type,traits>& x, const enum_set<enum_type,traits>& y)
     {
       enum_set<enum_type,traits> r = x;
       r &= y;
       return r;
-    } 
+    }
 
 
     template <typename enum_type,  typename traits >
@@ -200,7 +203,7 @@
       enum_set<enum_type,traits> r = x;
       r |= y;
       return r;
-    } 
+    }
 
     template <typename enum_type,  typename traits >
     enum_set<enum_type,traits> operator^(const enum_set<enum_type,traits>& x, const enum_set<enum_type,traits>& y)
@@ -208,8 +211,8 @@
       enum_set<enum_type,traits> r = x;
       r ^= y;
       return r;
-    } 
-    
+    }
+
 
     template <class charT, class ch_traits, typename enum_type,  typename traits >
     std::basic_istream<charT, ch_traits>&
@@ -217,19 +220,19 @@
     {
       return is >> x.detail_bits();
     }
-    
+
 
     template <class charT, class ch_traits, typename enum_type,  typename traits >
     std::basic_ostream<charT, ch_traits>&
-    operator<<(std::basic_ostream<charT, ch_traits>& os, const enum_set<enum_type,traits>& x) 
+    operator<<(std::basic_ostream<charT, ch_traits>& os, const enum_set<enum_type,traits>& x)
     {
       return os << x.detail_bits();
     }
 
-    
+
   } /* namespace enums */
 
-  template <typename enum_type, typename traits > 
+  template <typename enum_type, typename traits >
   struct hash<enums::enum_set<enum_type,traits> >
   : public std::unary_function<enums::enum_set<enum_type,traits>, std::size_t>
   {