Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70004 - in sandbox/enums/boost/enums: . mpl
From: vicente.botet_at_[hidden]
Date: 2011-03-15 16:59:58


Author: viboes
Date: 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
New Revision: 70004
URL: http://svn.boost.org/trac/boost/changeset/70004

Log:
Enums: Addes enum_class/type_cons/no_cons and enum_subrange classes, enum_value, underlying_value functions and adapted to the new functions
Added:
   sandbox/enums/boost/enums/enum_class_cons.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_class_no_cons.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_subrange.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_type_cons.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_type_no_cons.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_value.hpp (contents, props changed)
   sandbox/enums/boost/enums/underlying_value.hpp (contents, props changed)
Text files modified:
   sandbox/enums/boost/enums/default_value.hpp | 4 +-
   sandbox/enums/boost/enums/emulation.hpp | 69 ++++++++++++++++++++-------------------
   sandbox/enums/boost/enums/emulator_type.hpp | 13 +++++--
   sandbox/enums/boost/enums/enum_array.hpp | 42 ++++++++++++------------
   sandbox/enums/boost/enums/enum_class_macro.hpp | 2
   sandbox/enums/boost/enums/enum_range.hpp | 30 ++++++++--------
   sandbox/enums/boost/enums/enum_set.hpp | 40 +++++++++++-----------
   sandbox/enums/boost/enums/enum_subrange_traiter.hpp | 8 ++--
   sandbox/enums/boost/enums/enum_traiter.hpp | 24 ++++++------
   sandbox/enums/boost/enums/enum_traits.hpp | 20 +++++-----
   sandbox/enums/boost/enums/enum_type.hpp | 10 ++++-
   sandbox/enums/boost/enums/include.hpp | 2
   sandbox/enums/boost/enums/mpl/greater.hpp | 4 +-
   sandbox/enums/boost/enums/mpl/greater_equal.hpp | 2
   sandbox/enums/boost/enums/mpl/less.hpp | 2
   sandbox/enums/boost/enums/mpl/numeric_cast.hpp | 2
   sandbox/enums/boost/enums/pos.hpp | 22 ++++++------
   sandbox/enums/boost/enums/size.hpp | 18 +++++-----
   sandbox/enums/boost/enums/succ.hpp | 6 +-
   sandbox/enums/boost/enums/underlying_type.hpp | 16 ++++----
   sandbox/enums/boost/enums/val.hpp | 20 +++++-----
   21 files changed, 183 insertions(+), 173 deletions(-)

Modified: sandbox/enums/boost/enums/default_value.hpp
==============================================================================
--- sandbox/enums/boost/enums/default_value.hpp (original)
+++ sandbox/enums/boost/enums/default_value.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -19,8 +19,8 @@
   namespace enums {
 
     //! builds a enum class with the default value.
-
- //! \return the default value
+
+ //! \return the default value
     template <typename EC>
     inline EC default_value()
     {

Modified: sandbox/enums/boost/enums/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulation.hpp (original)
+++ sandbox/enums/boost/enums/emulation.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -17,7 +17,8 @@
 #include <boost/enums/enum_type.hpp>
 #include <boost/enums/emulator_type.hpp>
 #include <boost/enums/default_value.hpp>
-#include <boost/enums/get_value.hpp>
+#include <boost/enums/enum_value.hpp>
+#include <boost/enums/underlying_value.hpp>
 #include <boost/conversion/convert_to.hpp>
 #include <boost/preprocessor/if.hpp>
 #include <boost/preprocessor/empty.hpp>
@@ -37,13 +38,13 @@
 
   #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP) \
       friend inline BOOST_CONSTEXPR bool operator OP(EC lhs, EC rhs) { \
- return lhs.get() OP rhs.get(); \
+ return lhs.enum_value() OP rhs.enum_value(); \
       } \
       friend inline BOOST_CONSTEXPR bool operator OP(type lhs, EC rhs) { \
- return lhs OP rhs.get(); \
+ return lhs OP rhs.enum_value(); \
       } \
       friend inline BOOST_CONSTEXPR bool operator OP(EC lhs, type rhs) { \
- return lhs.get() OP rhs; \
+ return lhs.enum_value() OP rhs; \
       }
 
 #endif // BOOST_NO_SCOPED_ENUMS
@@ -114,34 +115,20 @@
       , boost::dummy::type_tag<UT> const& \
     ) \
     { \
- return static_cast<UT>(boost::enums::get_value(v) ); \
+ return boost::enums::underlying_value(v); \
     }
 #else
 
 #define BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
   EC() : val_(static_cast<underlying_type>(type())) { } \
- EC(type v) : val_(static_cast<underlying_type>(v)) { }
+ EC(type v) : val_(static_cast<underlying_type>(v)) { } \
+ explicit EC(underlying_type v) : val_(v) { }
 
-#define BOOST_ENUMS_DETAIL_CONSTRUCTORS_AUX() \
- BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)
 
 #define BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
- operator UT() { return val_; }
+ operator underlying_type() { return val_; } \
+ operator type() { return type(val_); }
 
-#define BOOST_ENUMS_DETAIL_CONVERSIONS_AUX() \
- BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT)
-
-#define BOOST_ENUM_CLASS_START(EC, UT) \
- class EC \
- { \
- public: \
- enum type
-
-#define BOOST_ENUM_TYPE_START(EC, UT) \
- class EC \
- { \
- public: \
- enum type
 
 #define BOOST_ENUMS_DETAIL_END_1(EC, UT) \
     ; \
@@ -153,29 +140,29 @@
 
 
 #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
- inline EC convert_to(UT v \
+ inline friend EC convert_to(UT v \
     , boost::dummy::type_tag<EC> const& \
   ) \
   { \
     return EC::convert_to(v); \
   } \
- inline EC convert_to(boost::enums::enum_type<EC>::type v \
+ inline friend EC convert_to(boost::enums::enum_type<EC>::type v \
     , boost::dummy::type_tag<EC> const& \
   ) \
   { \
     return EC::convert_to(v); \
   } \
- inline UT convert_to(EC v \
+ inline friend UT convert_to(EC v \
     , boost::dummy::type_tag<UT> const& \
   ) \
   { \
- return (UT)(boost::enums::get_value(v) ); \
+ return boost::enums::underlying_value(v); \
   } \
- inline boost::enums::enum_type<EC>::type convert_to(EC v \
+ inline friend boost::enums::enum_type<EC>::type convert_to(EC v \
     , boost::dummy::type_tag<boost::enums::enum_type<EC>::type> const& \
   ) \
   { \
- return boost::enums::get_value(v); \
+ return boost::enums::enum_value(v); \
   }
 
 
@@ -202,13 +189,17 @@
     res.val_=static_cast<underlying_type>(v); \
     return res; \
   } \
- type get() const \
+ type enum_value() const \
   { \
     return type(val_); \
   } \
+ underlying_type underlying_value() const \
+ { \
+ return val_; \
+ } \
   BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT) \
-}; \
-BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT)
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+};
 
 
 #endif
@@ -253,11 +244,21 @@
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
   #define BOOST_ENUMS_SPECIALIZATIONS(EC, UT) \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
- BOOST_ENUMS_DETAIL_EMULATOR_TYPE_SPEC(EC)
+ BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT)
 
 #else // BOOST_NO_SCOPED_ENUMS
 
+ #define BOOST_ENUM_CLASS_START(EC, UT) \
+ class EC \
+ { \
+ public: \
+ enum type
+
+ #define BOOST_ENUM_TYPE_START(EC, UT) \
+ class EC \
+ { \
+ public: \
+ enum type
 
 
   #define BOOST_ENUM_CLASS_END(EC, UT) \

Modified: sandbox/enums/boost/enums/emulator_type.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulator_type.hpp (original)
+++ sandbox/enums/boost/enums/emulator_type.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -13,7 +13,7 @@
 /*!
  \file
  \brief
- The header \c <boost/enums/emulator!type.hpp> defines the declaration of emulator_type<> meta-function.
+ The header \c <boost/enums/emulator_type.hpp> defines the declaration of emulator_type<> meta-function.
  */
 
 #ifndef BOOST_ENUMS_EMULATOR_TYPE_HPP
@@ -27,10 +27,15 @@
   {
     /*! meta-function used to get the wrapping class of an enum when emulation
      is used or the enum class itself when available.
- This meta-function must be specialized for each enum class.
- */
+ This meta-function must be specialized for each enum class.
+ */
     template <typename EC_type>
- struct emulator_type;
+ struct emulator_type
+ {
+ //! Depending on whethere the compiler supports scoped enums or nor the nested type must be the same type or the emulated one.
+ //! By default this metafunction defines it as if scoped enums where supported so the specialization will be needed only when emulation is needed.
+ typedef EC_type type;
+ };
   }
 }
 

Modified: sandbox/enums/boost/enums/enum_array.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_array.hpp (original)
+++ sandbox/enums/boost/enums/enum_array.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -64,14 +64,14 @@
     \c enum_array<T, EC>, then it obeys the identity
 
      \code
- &a[n] == &a[0] + n for all 0 <= n < meta::size<EC>::value.
- \endcode
-
+ &a[n] == &a[0] + n for all 0 <= n < meta::size<EC>::value.
+ \endcode
+
     An \c enum_array is an aggregate that can (????) be initialized with the syntax
 
      \code
       enum_array<T, EC> a = { initializer-list };
- \endcode
+ \endcode
 
     where \e initializer-list is a comma separated list of up to \c meta::size<EC>::value
     elements whose types are convertible to \c T.
@@ -82,19 +82,19 @@
     some of the requirements of a sequence container. Descriptions are provided
     here only for operations on enum_array that are not described in one of these
     tables and for operations where there is additional semantic information.
-
- The conditions for an aggregate are met. Class enum_array relies on
- the implicitly-declared special member functions to conform to the
- container requirements
-
-
+
+ The conditions for an aggregate are met. Class enum_array relies on
+ the implicitly-declared special member functions to conform to the
+ container requirements
+
+
 
     \note The member variable elems is shown for exposition only, to emphasize
     that enum_array is a class aggregate. The name elems is not part of
     enum_array's interface
-
- \param T array's element type
- \param EC array's index enumeration class
+
+ \param T array's element type
+ \param EC array's index enumeration class
   */
 
     template<class T, typename EC>
@@ -116,8 +116,8 @@
         typedef std::size_t size_type;
         typedef std::ptrdiff_t difference_type;
         static const std::size_t static_size = meta::size<EC>::value;
- //enum_array() {}
-
+ //enum_array() {}
+
         // iterator support
         //! \returns iterator for the first element
         //! \throws Nothing
@@ -245,7 +245,7 @@
         }
 
         // size is constant
- //! \returns linear in meta::size<EC>::value.
+ //! \returns linear in meta::size<EC>::value.
         BOOST_CONSTEXPR size_type size()
         {
           return static_size;
@@ -368,11 +368,11 @@
     }
 
     //! enum_array's swap
-
+
     //! <b>Effects:</b> As
     //! \code
- //! x.swap(y);
- //! \endcode
+ //! x.swap(y);
+ //! \endcode
     //! <b>Complexity:</b> linear in \c meta::size<EC>::value.
 
     template<class T, typename EC>
@@ -411,14 +411,14 @@
     template <typename T, typename EC>
     T(&get_c_array(enum_array<T,EC>& arg))[meta::size<EC>::value]
     {
- //! c_array conversion.
+ //! c_array conversion.
         return arg.elems;
     }
     
     template <typename T, typename EC>
     const T(&get_c_array(const enum_array<T,EC>& arg))[meta::size<EC>::value]
     {
- //! c_array const conversion.
+ //! c_array const conversion.
         return arg.elems;
     }
 #endif

Added: sandbox/enums/boost/enums/enum_class_cons.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_class_cons.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,223 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_class_cons.hpp> defines the declaration of enum_class_cons<> template class.
+ */
+
+#ifndef BOOST_ENUMS_ENUM_TYPE_CONS_HPP
+#define BOOST_ENUMS_ENUM_TYPE_CONS_HPP
+
+#include <boost/config.hpp>
+
+namespace boost
+{
+ namespace enums
+ {
+ template <typename ScopedEnum, typename UT=typename ScopedEnum::type>
+ class enum_class_cons : public ScopedEnum
+ {
+ public:
+ typedef typename ScopedEnum::type type;
+ typedef UT underlying_type;
+ private:
+ underlying_type val_;
+ public:
+ // default constructor
+ enum_class_cons()
+ : val_(static_cast<underlying_type>(type()))
+ {
+ }
+ // explicit constructor from underlying type
+ explicit enum_class_cons(underlying_type v)
+ : val_(v)
+ {
+ }
+ // constructor from enum type
+ enum_class_cons(type v)
+ : val_(static_cast<underlying_type>(v))
+ {
+ }
+ // assignment
+ enum_class_cons& operator=(enum_class_cons rhs)
+ {
+ val_=rhs.val_;
+ return *this;
+ }
+ // assignment from enum literals
+ enum_class_cons& operator=(type rhs)
+ {
+ val_=static_cast<underlying_type>(rhs);
+ return *this;
+ }
+ // workaround when there are no constructors
+ static enum_class_cons default_value()
+ {
+ enum_class_cons res;
+ res.val_=static_cast<underlying_type>(type());
+ return res;
+ }
+
+ static enum_class_cons convert_to(underlying_type v)
+ {
+ enum_class_cons res;
+ res.val_=v;
+ return res;
+
+ }
+ static enum_class_cons convert_to(type v)
+ {
+ enum_class_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+ // explicit conversion function to enum type
+ type enum_value() const
+ {
+ return type(val_);
+ }
+ // explicit conversion function to underlying_type
+ underlying_type underlying_value() const
+ {
+ return val_;
+ }
+
+ //! equal operator
+ friend bool operator==(enum_class_cons lhs, enum_class_cons rhs)
+ {
+ return lhs.val_ == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(type lhs, enum_class_cons rhs)
+ {
+ return lhs == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_class_cons lhs, type rhs)
+ {
+ return lhs.val_ == rhs;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_class_cons lhs, enum_class_cons rhs)
+ {
+ return lhs.val_ != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(type lhs, enum_class_cons rhs)
+ {
+ return lhs != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_class_cons lhs, type rhs)
+ {
+ return lhs.val_ != rhs;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_class_cons lhs, enum_class_cons rhs)
+ {
+ return lhs.val_ <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(type lhs, enum_class_cons rhs)
+ {
+ return lhs <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_class_cons lhs, type rhs)
+ {
+ return lhs.val_ <= rhs;
+ }
+ //! less operator
+ friend bool operator<(enum_class_cons lhs, enum_class_cons rhs)
+ {
+ return lhs.val_ < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(type lhs, enum_class_cons rhs)
+ {
+ return lhs < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(enum_class_cons lhs, type rhs)
+ {
+ return lhs.val_ < rhs;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_class_cons lhs, enum_class_cons rhs)
+ {
+ return lhs.val_ >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(type lhs, enum_class_cons rhs)
+ {
+ return lhs >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_class_cons lhs, type rhs)
+ {
+ return lhs.val_ >= rhs;
+ }
+ //! greater operator
+ friend bool operator>(enum_class_cons lhs, enum_class_cons rhs)
+ {
+ return lhs.val_ > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(type lhs, enum_class_cons rhs)
+ {
+ return lhs > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(enum_class_cons lhs, type rhs)
+ {
+ return lhs.val_ > rhs;
+ }
+#if 0
+ //! conversions from underlying_type to enum_type_cons following the Boost.Conversion protocol
+ friend enum_class_cons convert_to(underlying_type v,
+ boost::dummy::type_tag<enum_class_cons> const&)
+ {
+ enum_class_cons res;
+ res.val_=v;
+ return res;
+
+ }
+
+ //! friend conversions from type to enum_type_cons following the Boost.Conversion protocol
+ friend enum_class_cons convert_to(type v,
+ boost::dummy::type_tag<enum_class_cons> const&)
+ {
+ enum_class_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+#endif
+ //! conversions from enum_type_cons to underlying_type following the Boost.Conversion protocol
+ friend underlying_type convert_to(enum_class_cons v,
+ boost::dummy::type_tag<underlying_type> const&)
+ {
+ return boost::enums::underlying_value(v);
+ }
+
+ //! conversions from enum_type_cons to type following the Boost.Conversion protocol
+ friend type convert_to(enum_class_cons v,
+ boost::dummy::type_tag<type> const&)
+ {
+ return boost::enums::enum_value(v);
+ }
+ };
+ }
+}
+
+#endif // BOOST_ENUMS_ENUM_TYPE_MIXIN_HPP

Modified: sandbox/enums/boost/enums/enum_class_macro.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_class_macro.hpp (original)
+++ sandbox/enums/boost/enums/enum_class_macro.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -16,7 +16,7 @@
 #include <boost/enums/underlying_type.hpp>
 #include <boost/enums/enum_type.hpp>
 #include <boost/enums/default_value.hpp>
-#include <boost/enums/get_value.hpp>
+#include <boost/enums/enum_value.hpp>
 #include <boost/conversion/convert_to.hpp>
 #include <boost/config.hpp>
 #include <boost/preprocessor/join.hpp>

Added: sandbox/enums/boost/enums/enum_class_no_cons.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_class_no_cons.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,200 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_class_no_cons.hpp> defines the declaration of enum_class_no_cons<> template class.
+ */
+
+#ifndef BOOST_ENUMS_ENUM_TYPE_NO_CONS_HPP
+#define BOOST_ENUMS_ENUM_TYPE_NO_CONS_HPP
+
+#include <boost/config.hpp>
+
+namespace boost
+{
+ namespace enums
+ {
+ template <typename ScopedEnum, typename UT=typename ScopedEnum::type>
+ class enum_class_no_cons : public ScopedEnum
+ {
+ public:
+ typedef typename ScopedEnum::type type;
+ typedef UT underlying_type;
+ private:
+ underlying_type val_;
+ public:
+ // assignment
+ enum_class_no_cons& operator=(enum_class_no_cons rhs)
+ {
+ val_=rhs.val_;
+ return *this;
+ }
+ // assignment from enum literals
+ enum_class_no_cons& operator=(type rhs)
+ {
+ val_=static_cast<underlying_type>(rhs);
+ return *this;
+ }
+ // workaround when there are no constructors
+ static enum_class_no_cons default_value()
+ {
+ enum_class_no_cons res;
+ res.val_=static_cast<underlying_type>(type());
+ return res;
+ }
+ static enum_class_no_cons convert_to(underlying_type v)
+ {
+ enum_class_no_cons res;
+ res.val_=v;
+ return res;
+
+ }
+ static enum_class_no_cons convert_to(type v)
+ {
+ enum_class_no_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+ // explicit conversion function to enum type
+ type enum_value() const
+ {
+ return type(val_);
+ }
+ // explicit conversion function to underlying_type
+ underlying_type underlying_value() const
+ {
+ return val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_class_no_cons lhs, enum_class_no_cons rhs)
+ {
+ return lhs.val_ == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(type lhs, enum_class_no_cons rhs)
+ {
+ return lhs == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_class_no_cons lhs, type rhs)
+ {
+ return lhs.val_ == rhs;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_class_no_cons lhs, enum_class_no_cons rhs)
+ {
+ return lhs.val_ != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(type lhs, enum_class_no_cons rhs)
+ {
+ return lhs != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_class_no_cons lhs, type rhs)
+ {
+ return lhs.val_ != rhs;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_class_no_cons lhs, enum_class_no_cons rhs)
+ {
+ return lhs.val_ <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(type lhs, enum_class_no_cons rhs)
+ {
+ return lhs <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_class_no_cons lhs, type rhs)
+ {
+ return lhs.val_ <= rhs;
+ }
+ //! less operator
+ friend bool operator<(enum_class_no_cons lhs, enum_class_no_cons rhs)
+ {
+ return lhs.val_ < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(type lhs, enum_class_no_cons rhs)
+ {
+ return lhs < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(enum_class_no_cons lhs, type rhs)
+ {
+ return lhs.val_ < rhs;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_class_no_cons lhs, enum_class_no_cons rhs)
+ {
+ return lhs.val_ >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(type lhs, enum_class_no_cons rhs)
+ {
+ return lhs >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_class_no_cons lhs, type rhs)
+ {
+ return lhs.val_ >= rhs;
+ }
+ //! greater operator
+ friend bool operator>(enum_class_no_cons lhs, enum_class_no_cons rhs)
+ {
+ return lhs.val_ > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(type lhs, enum_class_no_cons rhs)
+ {
+ return lhs > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(enum_class_no_cons lhs, type rhs)
+ {
+ return lhs.val_ > rhs;
+ }
+
+ // friend conversions to follow the Boost.Conversion protocol
+ friend enum_class_no_cons convert_to(underlying_type v,
+ boost::dummy::type_tag<enum_class_no_cons> const&)
+ {
+ enum_class_no_cons res;
+ res.val_=v;
+ return res;
+
+ }
+ friend enum_class_no_cons convert_to(type v,
+ boost::dummy::type_tag<enum_class_no_cons> const&)
+ {
+ enum_class_no_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+ friend underlying_type convert_to(enum_class_no_cons v,
+ boost::dummy::type_tag<underlying_type> const&)
+ {
+ return boost::enums::underlying_value(v);
+ }
+ friend type convert_to(enum_class_no_cons v,
+ boost::dummy::type_tag<type> const&)
+ {
+ return boost::enums::enum_value(v);
+ }
+ };
+ }
+}
+
+#endif // BOOST_ENUMS_ENUM_TYPE_MIXIN_HPP

Modified: sandbox/enums/boost/enums/enum_range.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_range.hpp (original)
+++ sandbox/enums/boost/enums/enum_range.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -106,9 +106,9 @@
         };
     } // namespace enums_detail
     #endif
- //! \c enum_range is a model of the \e RandomAccessRange Concept associated to the enumeration \c EC.
-
-
+ //! \c enum_range is a model of the \e RandomAccessRange Concept associated to the enumeration \c EC.
+
+
     template<typename EC/* , typename Traits=enum_range_traits<EC> */ >
     class enum_range
         : public iterator_range< enums_detail::enum_iterator<EC/*, Traits*/> >
@@ -116,13 +116,13 @@
         typedef enums_detail::enum_iterator<EC/*, Traits*/> iterator_t;
         typedef iterator_range<iterator_t> base_t;
     public:
- //! builds a enum range
+ //! builds a enum range
         enum_range()
             : base_t(iterator_t(0), iterator_t(enums::meta::size<EC>::value))
         {
         }
-
- //! builds a enum sub-range
+
+ //! builds a enum sub-range
         enum_range(EC first, EC last)
             : base_t(iterator_t(enums::pos(first)),
                      iterator_t(enums::pos(last)+1))
@@ -133,7 +133,7 @@
     //! function to generate an enum range.
 
     //! \c make_range allows treating enums as a model of the \e RandomAccessRange Concept.
-
+
     //! \pre \c EC is a model of the \e Enumeration Concept.
 
     template<typename EC /*, typename Traits*/ >
@@ -142,14 +142,14 @@
     {
         return enum_range<EC/*,Traits*/>();
     }
-
- //! function to generate an enum sub-range.
-
- //! \c make_range allows treating enums as a model of the \e RandomAccessRange Concept.
- //! It should be noted that the first and last parameters denoted a closed range.
- //! \pre \c EC is a model of the \e Enumeration Concept.
- //! \param first first element of the range
- //! \param last last element of the range
+
+ //! function to generate an enum sub-range.
+
+ //! \c make_range allows treating enums as a model of the \e RandomAccessRange Concept.
+ //! It should be noted that the first and last parameters denoted a closed range.
+ //! \pre \c EC is a model of the \e Enumeration Concept.
+ //! \param first first element of the range
+ //! \param last last element of the range
     template<typename EC /*, typename Traits */ >
     enum_range<EC>
     make_range(EC first, EC last)

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-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -46,8 +46,8 @@
     class enum_set
     {
     public:
- struct reference {
- };
+ struct reference {
+ };
       //! <b> Effects:</b> Constructs an object of class \c enum_set<>, initializing all
       //! enumerations to zero.
       BOOST_CONSTEXPR enum_set()
@@ -245,7 +245,7 @@
         return *this;
       }
 
- //! \c <tt>unsigned long</tt> conversion
+ //! \c <tt>unsigned long</tt> conversion
       //! \throws overflow_error if the integral value \c x corresponding to the
       //! bits in \c *this cannot be represented as type <<tt>unsigned long</tt>.
       //! \returns \c x.
@@ -255,7 +255,7 @@
         return bits.to_ulong();
       }
 
- //! \c <tt>unsigned long long</tt> conversion
+ //! \c <tt>unsigned long long</tt> conversion
       //! \throws overflow_error if the integral value \c x corresponding to the
       //! bits in \c *this cannot be represented as type <tt>unsigned long long</tt>.
       //! \returns \c x.
@@ -347,8 +347,8 @@
 
     // enum_set operators:
 
- //! Intersection
-
+ //! Intersection
+
     //! \returns enum_set<EC>(lhs) &= rhs.
     template <typename EC/*, typename Traits*/>
     enum_set<EC/*,Traits*/> operator&(const enum_set<EC/*,Traits*/>& x, const enum_set<EC/*,Traits*/>& y)
@@ -358,8 +358,8 @@
       return r;
     }
 
- //! Union
-
+ //! Union
+
     //! \returns enum_set<EC>>(lhs) |= rhs.
     template <typename EC/*, typename Traits*/ >
     enum_set<EC/*,Traits*/> operator|(const enum_set<EC/*,Traits*/>& x, const enum_set<EC/*,Traits*/>& y)
@@ -369,7 +369,7 @@
       return r;
     }
 
- //! Exclusive union
+ //! Exclusive union
 
     //! \returns enum_set<EC>(lhs) ^= rhs.
     template <typename EC/*, typename Traits*/ >
@@ -381,8 +381,8 @@
     }
 
     //! A formatted input function.
-
- //! \details <b> Effects:</b> Extracts up to \c N characters from is. Stores these characters
+
+ //! \details <b> Effects:</b> Extracts up to \c N characters from is. Stores these characters
     //! in a temporary object \c str of type <tt>basic_string<charT, traits></tt>, then
     //! evaluates the expression <tt>x = enum_set<EC>(str)</tt>. Characters are extracted
     //! and stored until any of the following occurs:
@@ -392,10 +392,10 @@
     //! (in which case the input character is not extracted).\n
     //! If no characters are stored in \c str, calls \c is.setstate(ios_base::failbit)
     //! (which may throw <tt>ios_- base::failure</tt>).
- //! \param is the input stream.
- //! \param x the \c enum_set.
- //! \returns \c is.
-
+ //! \param is the input stream.
+ //! \param x the \c enum_set.
+ //! \returns \c is.
+
     template <class charT, class ch_traits, typename EC/*, typename Traits*/ >
     std::basic_istream<charT, ch_traits>&
     operator>>(std::basic_istream<charT, ch_traits>& is, enum_set<EC/*,Traits*/>& x)
@@ -403,10 +403,10 @@
       return is >> x.detail_bits();
     }
 
- //! A formatted output function.
+ //! A formatted output function.
 
- //! \param os the output stream.
- //! \param x the \c enum_set.
+ //! \param os the output stream.
+ //! \param x the \c enum_set.
     //! \returns <tt>os << x.template to_string<charT,traits,allocator<charT> >(
     //! use_facet<ctype<charT> >(os.getloc()).widen('0'),
     //! use_facet<ctype<charT> >(os.getloc()).widen('1'))</tt>
@@ -421,12 +421,12 @@
   } /* namespace enums */
 
   //! hash template specialization
-
+
   template <typename EC/*, typename Traits*/ >
   struct hash<enums::enum_set<EC/*,Traits*/> >
   : public std::unary_function<enums::enum_set<EC/*,Traits*/>, std::size_t>
   {
- //! \details the template specialization meets the requirements of class template \c hash.
+ //! \details the template specialization meets the requirements of class template \c hash.
     std::size_t operator()(const enums::enum_set<EC/*,Traits*/>& bs) const
     {
       return hash<std::bitset<enums::meta::size<EC>::size> >(bs.detail_bits());

Added: sandbox/enums/boost/enums/enum_subrange.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_subrange.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,38 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ENUMS_ENUM_SUBRANGE_HPP
+#define BOOST_ENUMS_ENUM_SUBRANGE_HPP
+
+#include <boost/enums/pos.hpp>
+#include <boost/enums/first.hpp>
+#include <boost/enums/last.hpp>
+#include <boost/enums/emulator_type.hpp>
+
+namespace boost {
+ namespace enums {
+ template <
+ typename EC_type,
+ EC_type First=enums::meta::first<typename emulator_type<EC_type>::type >::value,
+ EC_type Last=enums::meta::last<typename emulator_type<EC_type>::type >::value
+ >
+ struct enum_subrange
+ {
+ typedef typename emulator_type<EC_type>::type EC;
+ static const std::size_t first_index = enums::meta::pos<EC,First>::value;
+ static const std::size_t last_index = enums::meta::pos<EC,Last>::value;
+
+ };
+ }
+}
+
+#endif // BOOST_ENUMS_ENUM_SUBRANGE_HPP

Modified: sandbox/enums/boost/enums/enum_subrange_traiter.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_subrange_traiter.hpp (original)
+++ sandbox/enums/boost/enums/enum_subrange_traiter.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -10,8 +10,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_ENUMS_ENUM_RANGE_TRAITER_HPP
-#define BOOST_ENUMS_ENUM_RANGE_TRAITER_HPP
+#ifndef BOOST_ENUMS_ENUM_SUBRANGE_HPP
+#define BOOST_ENUMS_ENUM_SUBRANGE_HPP
 
 #include <boost/enums/pos.hpp>
 #include <boost/enums/first.hpp>
@@ -25,7 +25,7 @@
         EC_type First=enums::meta::first<typename emulator_type<EC_type>::type >::value,
         EC_type Last=enums::meta::last<typename emulator_type<EC_type>::type >::value
>
- struct enum_subrange_traiter
+ struct enum_subrange
     {
       typedef typename emulator_type<EC_type>::type EC;
       static const std::size_t first_index = enums::meta::pos<EC,First>::value;
@@ -35,4 +35,4 @@
   }
 }
 
-#endif // BOOST_ENUMS_ENUM_RANGE_TRAITER_HPP
+#endif // BOOST_ENUMS_ENUM_SUBRANGE_HPP

Modified: sandbox/enums/boost/enums/enum_traiter.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_traiter.hpp (original)
+++ sandbox/enums/boost/enums/enum_traiter.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -31,7 +31,7 @@
 namespace boost {
   namespace enums {
 
- //! Helper class used as \c enum_trait<> for enumerations having a linear progression.
+ //! Helper class used as \c enum_trait<> for enumerations having a linear progression.
     template <
       typename EC
>
@@ -48,20 +48,20 @@
           );
       BOOST_STATIC_CONSTEXPR std::size_t step = (last_value-first_value)/(meta::size<EC>::value-1);
     public:
- //! pos specialization.
-
- //! \returns the returned value is calculated from the underlying value,
- //! the \c first_value and the \c step, following this formula \c (ut-first_value)/step
+ //! pos specialization.
+
+ //! \returns the returned value is calculated from the underlying value,
+ //! the \c first_value and the \c step, following this formula \c (ut-first_value)/step
       static std::size_t pos(EC e)
       {
- typename underlying_type<EC>::type uv = static_cast<typename underlying_type<EC>::type>(get_value(e));
+ typename underlying_type<EC>::type uv = underlying_value(e);
         return (uv-first_value)/step;
       }
- //! val specialization.
-
- //! \returns the returned value is calculated from the position \c p,
- //! the first value and the step, following this formula \c p*step+first_value
- static EC val(std::size_t p)
+ //! val specialization.
+
+ //! \returns the returned value is calculated from the position \c p,
+ //! the first value and the step, following this formula \c p*step+first_value
+ static EC val(std::size_t p)
       {
         typename underlying_type<EC>::type uv = p*step+first_value;
         return boost::convert_to<EC>(uv);
@@ -76,7 +76,7 @@
 // public:
 // static std::size_t pos(EC e)
 // {
-// return (get_value(e));
+// return (enum_value(e));
 // }
 // static EC val(std::size_t i)
 // {

Modified: sandbox/enums/boost/enums/enum_traits.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_traits.hpp (original)
+++ sandbox/enums/boost/enums/enum_traits.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -25,19 +25,19 @@
   namespace enums
   {
     namespace meta
- {
+ {
       template <typename EC>
 #ifndef BOOST_ENUMS_DOXYGEN_INVOKED
- struct enum_traits;
+ struct enum_traits;
 #else
- struct enum_traits
- {
- //! The specialization must define this function prototype
- static std::size_t pos(EC e);
- //! The specialization must define this function prototype
- static EC val(std::size_t p);
- };
-#endif
+ struct enum_traits
+ {
+ //! The specialization must define this function prototype
+ static std::size_t pos(EC e);
+ //! The specialization must define this function prototype
+ static EC val(std::size_t p);
+ };
+#endif
 
     }
   }

Modified: sandbox/enums/boost/enums/enum_type.hpp
==============================================================================
--- sandbox/enums/boost/enums/enum_type.hpp (original)
+++ sandbox/enums/boost/enums/enum_type.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -24,10 +24,14 @@
     template <typename EC>
     struct enum_type
     {
-#ifdef BOOST_NO_SCOPED_ENUMS
- typedef typename EC::type type;
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
+ #ifdef BOOST_NO_SCOPED_ENUMS
+ typedef typename EC::type type;
+ #else
+ typedef EC type;
+ #endif
 #else
- typedef EC type;
+ typedef <see below> type;
 #endif
     };
   }

Added: sandbox/enums/boost/enums/enum_type_cons.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_type_cons.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,230 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_type_cons.hpp> defines the declaration of enum_type_cons<> template class.
+ */
+
+#ifndef BOOST_ENUMS_ENUM_TYPE_CONS_HPP
+#define BOOST_ENUMS_ENUM_TYPE_CONS_HPP
+
+#include <boost/config.hpp>
+
+namespace boost
+{
+ namespace enums
+ {
+ template <typename ScopedEnum, typename UT=typename ScopedEnum::type>
+ class enum_type_cons : public ScopedEnum
+ {
+ public:
+ typedef typename ScopedEnum::type type;
+ typedef UT underlying_type;
+ private:
+ underlying_type val_;
+ public:
+ // default constructor
+ enum_type_cons()
+ : val_(static_cast<underlying_type>(type()))
+ {
+ }
+ // explicit constructor from underlying type
+ explicit enum_type_cons(underlying_type v)
+ : val_(v)
+ {
+ }
+ // constructor from enum type
+ enum_type_cons(type v)
+ : val_(static_cast<underlying_type>(v))
+ {
+ }
+ // implicit conversion to underlying_type
+ operator underlying_type()
+ {
+ return val_;
+ }
+ // implicit conversion to enum type
+ operator type()
+ {
+ return type(val_);
+ }
+ // assignment
+ enum_type_cons& operator=(enum_type_cons rhs)
+ {
+ val_=rhs.val_;
+ return *this;
+ }
+ // assignment from enum literals
+ enum_type_cons& operator=(type rhs)
+ {
+ val_=static_cast<underlying_type>(rhs);
+ return *this;
+ }
+ // workaround in case there are no constructors
+ static enum_type_cons default_value()
+ {
+ enum_type_cons res;
+ res.val_=static_cast<underlying_type>(type());
+ return res;
+ }
+ static enum_type_cons convert_to(underlying_type v)
+ {
+ enum_type_cons res;
+ res.val_=v;
+ return res;
+
+ }
+ static enum_type_cons convert_to(type v)
+ {
+ enum_type_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+ // explicit conversion in case explicit conversions are not available
+ type enum_value() const
+ {
+ return type(val_);
+ }
+ underlying_type underlying_value() const
+ {
+ return val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_type_cons lhs, enum_type_cons rhs)
+ {
+ return lhs.val_ == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(type lhs, enum_type_cons rhs)
+ {
+ return lhs == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_type_cons lhs, type rhs)
+ {
+ return lhs.val_ == rhs;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_type_cons lhs, enum_type_cons rhs)
+ {
+ return lhs.val_ != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(type lhs, enum_type_cons rhs)
+ {
+ return lhs != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_type_cons lhs, type rhs)
+ {
+ return lhs.val_ != rhs;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_type_cons lhs, enum_type_cons rhs)
+ {
+ return lhs.val_ <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(type lhs, enum_type_cons rhs)
+ {
+ return lhs <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_type_cons lhs, type rhs)
+ {
+ return lhs.val_ <= rhs;
+ }
+ //! less operator
+ friend bool operator<(enum_type_cons lhs, enum_type_cons rhs)
+ {
+ return lhs.val_ < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(type lhs, enum_type_cons rhs)
+ {
+ return lhs < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(enum_type_cons lhs, type rhs)
+ {
+ return lhs.val_ < rhs;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_type_cons lhs, enum_type_cons rhs)
+ {
+ return lhs.val_ >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(type lhs, enum_type_cons rhs)
+ {
+ return lhs >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_type_cons lhs, type rhs)
+ {
+ return lhs.val_ >= rhs;
+ }
+ //! greater operator
+ friend bool operator>(enum_type_cons lhs, enum_type_cons rhs)
+ {
+ return lhs.val_ > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(type lhs, enum_type_cons rhs)
+ {
+ return lhs > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(enum_type_cons lhs, type rhs)
+ {
+ return lhs.val_ > rhs;
+ }
+
+#if 0
+ //! conversions from underlying_type to enum_type_cons following the Boost.Conversion protocol
+ friend enum_type_cons convert_to(underlying_type v,
+ boost::dummy::type_tag<enum_type_cons> const&)
+ {
+ enum_type_cons res;
+ res.val_=v;
+ return res;
+
+ }
+
+ //! friend conversions from type to enum_type_cons following the Boost.Conversion protocol
+ friend enum_type_cons convert_to(type v,
+ boost::dummy::type_tag<enum_type_cons> const&)
+ {
+ enum_type_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+#endif
+ //! conversions from enum_type_cons to underlying_type following the Boost.Conversion protocol
+ friend underlying_type convert_to(enum_type_cons v,
+ boost::dummy::type_tag<underlying_type> const&)
+ {
+ return boost::enums::underlying_value(v);
+ }
+ //! conversions from enum_type_cons to type following the Boost.Conversion protocol
+ friend type convert_to(enum_type_cons v,
+ boost::dummy::type_tag<type> const&)
+ {
+ return boost::enums::enum_value(v);
+ }
+ };
+ }
+}
+
+#endif // BOOST_ENUMS_ENUM_TYPE_MIXIN_HPP

Added: sandbox/enums/boost/enums/enum_type_no_cons.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_type_no_cons.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,208 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_type_no_cons.hpp> defines the declaration of enum_type_no_cons<> template class.
+ */
+
+#ifndef BOOST_ENUMS_ENUM_TYPE_NO_CONS_HPP
+#define BOOST_ENUMS_ENUM_TYPE_NO_CONS_HPP
+
+#include <boost/config.hpp>
+
+namespace boost
+{
+ namespace enums
+ {
+ template <typename ScopedEnum, typename UT=typename ScopedEnum::type>
+ class enum_type_no_cons : public ScopedEnum
+ {
+ public:
+ typedef typename ScopedEnum::type type;
+ typedef UT underlying_type;
+ private:
+ underlying_type val_;
+ public:
+ // implicit conversion for scoped enum type only
+ operator underlying_type()
+ {
+ return val_;
+ }
+ operator type()
+ {
+ return type(val_);
+ }
+ // assignment
+ enum_type_no_cons& operator=(enum_type_no_cons rhs)
+ {
+ val_=rhs.val_;
+ return *this;
+ }
+ // assignment from enum literals
+ enum_type_no_cons& operator=(type rhs)
+ {
+ val_=static_cast<underlying_type>(rhs);
+ return *this;
+ }
+ // workaround in case there are no constructors
+ static enum_type_no_cons default_value()
+ {
+ enum_type_no_cons res;
+ res.val_=static_cast<underlying_type>(type());
+ return res;
+ }
+ static enum_type_no_cons convert_to(underlying_type v)
+ {
+ enum_type_no_cons res;
+ res.val_=v;
+ return res;
+
+ }
+ static enum_type_no_cons convert_to(type v)
+ {
+ enum_type_no_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+ // explicit conversion in case explicit conversions are not available
+ type enum_value() const
+ {
+ return type(val_);
+ }
+ underlying_type underlying_value() const
+ {
+ return val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_type_no_cons lhs, enum_type_no_cons rhs)
+ {
+ return lhs.val_ == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(type lhs, enum_type_no_cons rhs)
+ {
+ return lhs == rhs.val_;
+ }
+ //! equal operator
+ friend bool operator==(enum_type_no_cons lhs, type rhs)
+ {
+ return lhs.val_ == rhs;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_type_no_cons lhs, enum_type_no_cons rhs)
+ {
+ return lhs.val_ != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(type lhs, enum_type_no_cons rhs)
+ {
+ return lhs != rhs.val_;
+ }
+ //! not_equal operator
+ friend bool operator!=(enum_type_no_cons lhs, type rhs)
+ {
+ return lhs.val_ != rhs;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_type_no_cons lhs, enum_type_no_cons rhs)
+ {
+ return lhs.val_ <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(type lhs, enum_type_no_cons rhs)
+ {
+ return lhs <= rhs.val_;
+ }
+ //! less_equal operator
+ friend bool operator<=(enum_type_no_cons lhs, type rhs)
+ {
+ return lhs.val_ <= rhs;
+ }
+ //! less operator
+ friend bool operator<(enum_type_no_cons lhs, enum_type_no_cons rhs)
+ {
+ return lhs.val_ < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(type lhs, enum_type_no_cons rhs)
+ {
+ return lhs < rhs.val_;
+ }
+ //! less operator
+ friend bool operator<(enum_type_no_cons lhs, type rhs)
+ {
+ return lhs.val_ < rhs;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_type_no_cons lhs, enum_type_no_cons rhs)
+ {
+ return lhs.val_ >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(type lhs, enum_type_no_cons rhs)
+ {
+ return lhs >= rhs.val_;
+ }
+ //! greater_equal operator
+ friend bool operator>=(enum_type_no_cons lhs, type rhs)
+ {
+ return lhs.val_ >= rhs;
+ }
+ //! greater operator
+ friend bool operator>(enum_type_no_cons lhs, enum_type_no_cons rhs)
+ {
+ return lhs.val_ > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(type lhs, enum_type_no_cons rhs)
+ {
+ return lhs > rhs.val_;
+ }
+ //! greater operator
+ friend bool operator>(enum_type_no_cons lhs, type rhs)
+ {
+ return lhs.val_ > rhs;
+ }
+
+ // friend conversions to follow the Boost.Conversion protocol
+ friend enum_type_no_cons convert_to(underlying_type v,
+ boost::dummy::type_tag<enum_type_no_cons> const&)
+ {
+ enum_type_no_cons res;
+ res.val_=v;
+ return res;
+
+ }
+ friend enum_type_no_cons convert_to(type v,
+ boost::dummy::type_tag<enum_type_no_cons> const&)
+ {
+ enum_type_no_cons res;
+ res.val_=static_cast<underlying_type>(v);
+ return res;
+ }
+ friend underlying_type convert_to(enum_type_no_cons v,
+ boost::dummy::type_tag<underlying_type> const&)
+ {
+ return boost::enums::underlying_value(v);
+ }
+ friend type convert_to(enum_type_no_cons v,
+ boost::dummy::type_tag<type> const&)
+ {
+ return boost::enums::enum_value(v);
+ }
+ };
+ }
+}
+
+#endif // BOOST_ENUMS_ENUM_TYPE_MIXIN_HPP

Added: sandbox/enums/boost/enums/enum_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_value.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,35 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ENUMS_ENUM_VALUE_HPP
+#define BOOST_ENUMS_ENUM_VALUE_HPP
+
+#include <boost/config.hpp>
+#include <boost/enums/enum_type.hpp>
+
+namespace boost {
+ namespace enums {
+
+ template <typename EC>
+ inline
+ typename enum_type<EC>::type enum_value(EC e)
+ {
+#ifdef BOOST_NO_SCOPED_ENUMS
+ return e.enum_value();
+#else
+ return e;
+#endif
+ }
+ }
+}
+
+#endif

Modified: sandbox/enums/boost/enums/include.hpp
==============================================================================
--- sandbox/enums/boost/enums/include.hpp (original)
+++ sandbox/enums/boost/enums/include.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -21,7 +21,7 @@
 #include <boost/enums/enum_traiter.hpp>
 #include <boost/enums/enum_traits.hpp>
 #include <boost/enums/enum_type.hpp>
-#include <boost/enums/get_value.hpp>
+#include <boost/enums/enum_value.hpp>
 #include <boost/enums/first.hpp>
 #include <boost/enums/last.hpp>
 #include <boost/enums/pos.hpp>

Modified: sandbox/enums/boost/enums/mpl/greater.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/greater.hpp (original)
+++ sandbox/enums/boost/enums/mpl/greater.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -27,11 +27,11 @@
   namespace mpl
   {
 
- //! \c greater_impl specialization for \c enum_c_tag
+ //! \c greater_impl specialization for \c enum_c_tag
     template<>
     struct greater_impl< enum_c_tag,enum_c_tag >
     {
- template< typename R1, typename R2 > struct apply
+ template< typename R1, typename R2 > struct apply
         : greater<
             integral_c<typename E1::underlying_type, (typename E1::underlying_type)(E1::value)>,
             integral_c<typename E2::underlying_type, (typename E2::underlying_type)(E2::value)>

Modified: sandbox/enums/boost/enums/mpl/greater_equal.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/greater_equal.hpp (original)
+++ sandbox/enums/boost/enums/mpl/greater_equal.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -26,7 +26,7 @@
 {
   namespace mpl
   {
- //! \c greater_equal_impl specialization for \c enum_c_tag
+ //! \c greater_equal_impl specialization for \c enum_c_tag
     template<>
     struct greater_equal_impl< enum_c_tag,enum_c_tag >
     {

Modified: sandbox/enums/boost/enums/mpl/less.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/less.hpp (original)
+++ sandbox/enums/boost/enums/mpl/less.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -27,7 +27,7 @@
   namespace mpl
   {
 
- //! \c less_impl specialization for \c enum_c_tag
+ //! \c less_impl specialization for \c enum_c_tag
 
     template<>
     struct less_impl< enum_c_tag,enum_c_tag >

Modified: sandbox/enums/boost/enums/mpl/numeric_cast.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/numeric_cast.hpp (original)
+++ sandbox/enums/boost/enums/mpl/numeric_cast.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -27,7 +27,7 @@
 {
   namespace mpl
   {
- //! \c numeric_cast specialization for \c integral_c_tag and \c enum_c_tag
+ //! \c numeric_cast specialization for \c integral_c_tag and \c enum_c_tag
     template<> struct numeric_cast< integral_c_tag,enum_c_tag >
     {
       template< typename N > struct apply

Modified: sandbox/enums/boost/enums/pos.hpp
==============================================================================
--- sandbox/enums/boost/enums/pos.hpp (original)
+++ sandbox/enums/boost/enums/pos.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -34,26 +34,26 @@
     {
       //! meta-function used to associate the an element of an enumeration to
       //! its relative position.
-
+
       //! \note This meta-function must be specialized for each element of the enumeration.
       template <typename EC, typename enum_type<EC>::type V>
 #ifndef BOOST_ENUMS_DOXYGEN_INVOKED
- struct pos;
+ struct pos;
 #else
- struct pos
- {
- constexpr std::size_t value=<to be defined for each specialization>;
- };
+ struct pos
+ {
+ constexpr std::size_t value=<to be defined for each specialization>;
+ };
 #endif
     }
 
-
- //! position of an enum literal \c e on the extension of the enumeration type \c EC.
-
+
+ //! position of an enum literal \c e on the extension of the enumeration type \c EC.
+
     //! The \c enum_traits class must be specialized and contain a \c pos function
     //! that returns the relative position of its argument \c e.
-
- //! \param e the enum literal
+
+ //! \param e the enum literal
     //! \returns the associated position
     //! \throws Nothing
     template <typename EC>

Modified: sandbox/enums/boost/enums/size.hpp
==============================================================================
--- sandbox/enums/boost/enums/size.hpp (original)
+++ sandbox/enums/boost/enums/size.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -26,17 +26,17 @@
 namespace boost {
   namespace enums {
     namespace meta {
- //! meta-function used to get the number of elements of an enumeration.
-
- //! \note This meta-function must be specialized for each enumeration.
- template <typename EC>
+ //! meta-function used to get the number of elements of an enumeration.
+
+ //! \note This meta-function must be specialized for each enumeration.
+ template <typename EC>
 #ifndef BOOST_ENUMS_DOXYGEN_INVOKED
- struct size;
+ struct size;
 #else
- struct size
- {
- constexpr std::size_t value=<to be defined for each specialization>;
- };
+ struct size
+ {
+ constexpr std::size_t value=<to be defined for each specialization>;
+ };
 #endif
     }
     template <typename EC>

Modified: sandbox/enums/boost/enums/succ.hpp
==============================================================================
--- sandbox/enums/boost/enums/succ.hpp (original)
+++ sandbox/enums/boost/enums/succ.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -43,9 +43,9 @@
       };
     }
 
-
- //! enum succesor.
-
+
+ //! enum succesor.
+
     //! param e the enum literal.
     //! \returns the successor of the enumeration element.
     //! \throws Invalid parameter if the position is the last one.

Modified: sandbox/enums/boost/enums/underlying_type.hpp
==============================================================================
--- sandbox/enums/boost/enums/underlying_type.hpp (original)
+++ sandbox/enums/boost/enums/underlying_type.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -23,19 +23,19 @@
   namespace enums
   {
     //! underlying type metafunction
-
- //! \c EC must be an enum type or the emulation of a scoped enum.\n\n
+
+ //! \c EC must be an enum type or the emulation of a scoped enum.\n\n
 
- //! The member typedef \c type name the underlying type of \c T.
- //! When scoped enums are emulated it is defined as \c typename \c EC::underlying_type.
- //! Otherwise is defined as \c std::underlying_type<EC>::type.
- //! This meta-function must be specialized for the compilers providing scoped enums
- //! but don't providing the \c std::underlying_type meta-function.
     template <typename EC>
     struct underlying_type
     {
 #ifdef BOOST_ENUMS_DOXYGEN_INVOKED
- typedef <see below> type;
+ //! The member typedef \c type name the underlying type of \c T.
+ //! When scoped enums are emulated it is defined as \c typename \c EC::underlying_type.
+ //! Otherwise is defined as \c std::underlying_type<EC>::type.
+ //! This meta-function must be specialized for the compilers providing scoped enums
+ //! but don't providing the \c std::underlying_type meta-function.
+ typedef see_below type;
 #else
       #ifdef BOOST_NO_SCOPED_ENUMS
         typedef typename EC::underlying_type type;

Added: sandbox/enums/boost/enums/underlying_value.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/underlying_value.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -0,0 +1,36 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_ENUMS_UNDERLYING_VALUE_HPP
+#define BOOST_ENUMS_UNDERLYING_VALUE_HPP
+
+#include <boost/config.hpp>
+#include <boost/enums/enum_type.hpp>
+
+namespace boost {
+ namespace enums {
+
+ template <typename EC>
+ inline
+ typename underlying_type<EC>::type
+ underlying_value(EC e)
+ {
+#ifdef BOOST_NO_SCOPED_ENUMS
+ return e.underlying_value();
+#else
+ return static_cast<typename underlying_type<EC>::type>(e);
+#endif
+ }
+ }
+}
+
+#endif // BOOST_ENUMS_UNDERLYING_VALUE_HPP

Modified: sandbox/enums/boost/enums/val.hpp
==============================================================================
--- sandbox/enums/boost/enums/val.hpp (original)
+++ sandbox/enums/boost/enums/val.hpp 2011-03-15 16:59:48 EDT (Tue, 15 Mar 2011)
@@ -32,23 +32,23 @@
     namespace meta
     {
       //! meta-function used to associate the position to an element of an enumeration.
-
+
       //! \note This meta-function must be specialized for each position of the enumeration,
       //! starting from 0 to the predecessor of the size of the enumeration .
       template <typename EC, std::size_t I>
 #ifndef BOOST_ENUMS_DOXYGEN_INVOKED
- struct val;
+ struct val;
 #else
- struct val
- {
- constexpr typename enum_type<EC>::type value=<to be defined for each specialization>;
- };
+ struct val
+ {
+ constexpr typename enum_type<EC>::type value=<to be defined for each specialization>;
+ };
 #endif
-
+
     }
- //! Value
-
- //! \param p the position
+ //! Value
+
+ //! \param p the position
     //! \returns The enum class element associated to the position \c p.
     //! \throws std::out_of_range if the position is out of range.
     template <typename EC>


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