Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69900 - in sandbox/enums/boost/enums: . mpl mpl/aux_ mpl/aux_/enum_range_c
From: vicente.botet_at_[hidden]
Date: 2011-03-12 13:51:08


Author: viboes
Date: 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
New Revision: 69900
URL: http://svn.boost.org/trac/boost/changeset/69900

Log:
Enums: Updated enum_array, enum_range, enum_set, enum_traits and meta functions +
Added emulator_type, sub-range, enum_range_c
Added:
   sandbox/enums/boost/enums/config.hpp (contents, props changed)
   sandbox/enums/boost/enums/emulator_type.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_subrange_traiter.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/O1_size.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/back.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/empty.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/front.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/iterator.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/size.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/aux_/enum_range_c/tag.hpp (contents, props changed)
   sandbox/enums/boost/enums/mpl/enum_range_c.hpp (contents, props changed)
Text files modified:
   sandbox/enums/boost/enums/emulation.hpp | 219 ++++++++++++++++++++----------------
   sandbox/enums/boost/enums/enum_array.hpp | 150 +++++++++++++++++++++----
   sandbox/enums/boost/enums/enum_range.hpp | 38 ++++--
   sandbox/enums/boost/enums/enum_set.hpp | 233 ++++++++++++++++++++++++++++++++++-----
   sandbox/enums/boost/enums/enum_traiter.hpp | 68 ++++++----
   sandbox/enums/boost/enums/enum_traits.hpp | 6
   sandbox/enums/boost/enums/enum_type.hpp | 9 +
   sandbox/enums/boost/enums/first.hpp | 14 +
   sandbox/enums/boost/enums/last.hpp | 12 +
   sandbox/enums/boost/enums/pos.hpp | 19 ++
   sandbox/enums/boost/enums/pred.hpp | 14 +
   sandbox/enums/boost/enums/succ.hpp | 14 +
   sandbox/enums/boost/enums/underlying_type.hpp | 30 +++-
   sandbox/enums/boost/enums/val.hpp | 16 ++
   14 files changed, 607 insertions(+), 235 deletions(-)

Added: sandbox/enums/boost/enums/config.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/config.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,52 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_CONFIG_HPP
+#define BOOST_ENUMS_CONFIG_HPP
+
+#include <boost/config.hpp>
+
+#define BOOST_NO_UNDERLYING_TYPE
+
+#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
+
+#if defined(__GNUC__)
+ #if defined(__GXX_EXPERIMENTAL_CXX0X__)
+ #if ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 6))
+ #define BOOST_NO_UNRESTRICTED_UNION
+ #endif
+ #else
+ #define BOOST_NO_UNRESTRICTED_UNION
+ #endif
+#else
+ #define BOOST_NO_UNRESTRICTED_UNION
+#endif
+
+#if defined(__GNUC__)
+ #if defined(__GXX_EXPERIMENTAL_CXX0X__)
+ #if ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5))
+ #define BOOST_NO_ENUM_UNRESTRICTED_UNION
+ #endif
+ #else
+ #define BOOST_NO_ENUM_UNRESTRICTED_UNION
+ #endif
+#else
+ #define BOOST_NO_ENUM_UNRESTRICTED_UNION
+#endif
+
+#endif // BOOST_ENUMS_CONFIG_HPP

Modified: sandbox/enums/boost/enums/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulation.hpp (original)
+++ sandbox/enums/boost/enums/emulation.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -15,44 +15,32 @@
 
 #include <boost/enums/underlying_type.hpp>
 #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/conversion/convert_to.hpp>
-#include <boost/config.hpp>
 #include <boost/preprocessor/if.hpp>
 #include <boost/preprocessor/empty.hpp>
-
-#define BOOST_NO_UNDERLYING_TYPE
-#define BOOST_ENUMS_USE_CONSTRUCTORS 1
+#include <boost/enums/config.hpp>
 
 #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
- #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP) \
- inline BOOST_CONSTEXPR bool operator OP(EC lhs, EC rhs) { \
- return (boost::enums::underlying_type<EC>::type)(lhs) \
- OP \
- (boost::enums::underlying_type<EC>::type)(rhs); \
+ #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP) \
+ inline BOOST_CONSTEXPR bool operator OP(EC lhs, EC rhs) { \
+ return (UT)(lhs) \
+ OP \
+ (UT)(rhs); \
       }
 
 #else // BOOST_NO_SCOPED_ENUMS
 
- #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(); \
- } \
- friend inline BOOST_CONSTEXPR bool operator OP(type lhs, EC rhs) { \
- return lhs OP rhs.get(); \
- } \
- friend inline BOOST_CONSTEXPR bool operator OP(EC lhs, type rhs) { \
+ #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(); \
+ } \
+ friend inline BOOST_CONSTEXPR bool operator OP(type lhs, EC rhs) { \
+ return lhs OP rhs.get(); \
+ } \
+ friend inline BOOST_CONSTEXPR bool operator OP(EC lhs, type rhs) { \
         return lhs.get() OP rhs; \
       }
 
@@ -74,29 +62,41 @@
 
 #endif // !defined(BOOST_NO_SCOPED_ENUMS) && ! defined(BOOST_NO_SCOPED_ENUMS_COMPARE)
 
-#ifndef BOOST_NO_SCOPED_ENUMS
-
- #ifdef BOOST_NO_UNDERLYING_TYPE
-
- #define BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
+ #define BOOST_ENUMS_DETAIL_EMULATOR_TYPE_SPEC(EC) \
       namespace boost { \
         namespace enums { \
           template <> \
- struct underlying_type<EC> \
+ struct emulator_type<enum_type<EC>::type> \
           { \
- typedef UT type; \
+ typedef EC type; \
           }; \
         } \
       }
 
+#ifndef BOOST_NO_SCOPED_ENUMS
+
+ #ifdef BOOST_NO_UNDERLYING_TYPE
+
+ #define BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
+ namespace boost { \
+ namespace enums { \
+ template <> \
+ struct underlying_type<EC> \
+ { \
+ typedef UT type; \
+ }; \
+ } \
+ }
+
   #else // BOOST_NO_UNDERLYING_TYPE
 
     #define BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT)
 
   #endif // BOOST_NO_UNDERLYING_TYPE
 
+
   #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
- inline EC convert_to(boost::enums::underlying_type<EC>::type v \
+ inline EC convert_to(UT v \
       , boost::dummy::type_tag<EC> const& \
     ) \
     { \
@@ -108,11 +108,11 @@
     { \
       return v; \
     } \
- inline boost::enums::underlying_type<EC>::type convert_to(EC v \
- , boost::dummy::type_tag<boost::enums::underlying_type<EC>::type> const& \
+ inline UT convert_to(EC v \
+ , boost::dummy::type_tag<UT> const& \
     ) \
     { \
- return static_cast<boost::enums::underlying_type<EC>::type>(boost::enums::get_value(v) ); \
+ return static_cast<UT>(boost::enums::get_value(v) ); \
     }
 
   #define BOOST_ENUM_CLASS_START(EC, UT) \
@@ -123,41 +123,51 @@
 
   #define BOOST_ENUM_CLASS_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
     BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
   #define BOOST_ENUM_TYPE_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
+
+ #define BOOST_ENUM_CLASS_NO_CONS_END(EC, UT) \
+ ; \
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
+
+ #define BOOST_ENUM_TYPE_NO_CONS_END(EC, UT) \
+ ; \
     BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
   #define BOOST_ENUM_CLASS_CONS_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
     BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
   #define BOOST_ENUM_TYPE_CONS_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
     BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
     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)
+
 #else // BOOST_NO_SCOPED_ENUMS
 
- #define BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
- EC() : val_(static_cast<underlying_type>(type())) { } \
+ #define BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
+ EC() : val_(static_cast<underlying_type>(type())) { } \
     EC(type v) : val_(static_cast<underlying_type>(v)) { }
 
- #define BOOST_ENUMS_DETAIL_CONSTRUCTORS_AUX() \
+ #define BOOST_ENUMS_DETAIL_CONSTRUCTORS_AUX() \
     BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)
 
   #define BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
     operator UT() { return val_; }
 
- #define BOOST_ENUMS_DETAIL_CONVERSIONS_AUX() \
+ #define BOOST_ENUMS_DETAIL_CONVERSIONS_AUX() \
     BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT)
 
   #define BOOST_ENUM_CLASS_START(EC, UT) \
@@ -172,7 +182,7 @@
     public: \
       enum type
 
- #define BOOST_ENUMS_DETAIL_END_1(EC, UT) \
+ #define BOOST_ENUMS_DETAIL_END_1(EC, UT) \
       ; \
       typedef UT underlying_type; \
     private: \
@@ -182,7 +192,7 @@
 
 
   #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
- inline EC convert_to(boost::enums::underlying_type<EC>::type v \
+ inline EC convert_to(UT v \
       , boost::dummy::type_tag<EC> const& \
     ) \
     { \
@@ -194,70 +204,85 @@
     { \
       return EC::convert_to(v); \
     } \
- inline boost::enums::underlying_type<EC>::type convert_to(EC v \
- , boost::dummy::type_tag<boost::enums::underlying_type<EC>::type> const& \
+ inline UT convert_to(EC v \
+ , boost::dummy::type_tag<UT> const& \
     ) \
     { \
- return (boost::enums::underlying_type<EC>::type)(boost::enums::get_value(v) ); \
+ return (UT)(boost::enums::get_value(v) ); \
     } \
     inline 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::get_value(v); \
     }
 
 
- #define BOOST_ENUMS_DETAIL_END_2(EC, UT) \
- EC& operator =(type rhs) { \
- val_=static_cast<underlying_type>(rhs); \
- return *this; \
- } \
- static EC default_value() \
- { \
- EC res; \
- res.val_=static_cast<underlying_type>(EC::type()); \
- return res; \
- } \
- static EC convert_to(underlying_type v) \
- { \
- EC res; \
- res.val_=v; \
- return res; \
- } \
- static EC convert_to(type v) \
- { \
- EC res; \
- res.val_=static_cast<underlying_type>(v); \
- return res; \
- } \
- type get() const \
- { \
- return type(val_); \
- } \
- BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)\
- }; \
+ #define BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+ EC& operator =(type rhs) { \
+ val_=static_cast<underlying_type>(rhs); \
+ return *this; \
+ } \
+ static EC default_value() \
+ { \
+ EC res; \
+ res.val_=static_cast<underlying_type>(EC::type()); \
+ return res; \
+ } \
+ static EC convert_to(underlying_type v) \
+ { \
+ EC res; \
+ res.val_=v; \
+ return res; \
+ } \
+ static EC convert_to(type v) \
+ { \
+ EC res; \
+ res.val_=static_cast<underlying_type>(v); \
+ return res; \
+ } \
+ type get() const \
+ { \
+ return type(val_); \
+ } \
+ BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT) \
+ }; \
     BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT)
 
- #define BOOST_ENUM_CLASS_END(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_DETAIL_END_1(EC, UT) \
- BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
- BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+ #define BOOST_ENUM_CLASS_END(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_DETAIL_END_1(EC, UT) \
+ BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+
+ #define BOOST_ENUM_CLASS_NO_CONS_END(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_1(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+
+ #define BOOST_ENUM_TYPE_NO_CONS_END(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_1(EC, UT) \
+ BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+
+ #define BOOST_ENUM_CLASS_CONS_END(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_1(EC, UT) \
+ BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+
+ #define BOOST_ENUM_TYPE_CONS_END(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_1(EC, UT) \
+ BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
+ BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_END_2(EC, UT) \
 
- #define BOOST_ENUM_CLASS_CONS_END(EC, UT) \
- BOOST_ENUMS_DETAIL_END_1(EC, UT) \
- BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
- BOOST_ENUMS_DETAIL_END_2(EC, UT) \
 
- #define BOOST_ENUM_TYPE_CONS_END(EC, UT) \
- BOOST_ENUMS_DETAIL_END_1(EC, UT) \
- BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
- BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
- BOOST_ENUMS_DETAIL_END_2(EC, UT) \
+#define BOOST_ENUMS_SPECIALIZATIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_EMULATOR_TYPE_SPEC(EC)
+
 
 #endif // BOOST_NO_SCOPED_ENUMS
 #endif

Added: sandbox/enums/boost/enums/emulator_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/emulator_type.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,30 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_EMULATOR_TYPE_HPP
+#define BOOST_ENUMS_EMULATOR_TYPE_HPP
+
+#include <boost/config.hpp>
+
+namespace boost
+{
+ namespace enums
+ {
+ //! 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.
+ template <typename EC_type>
+ struct emulator_type;
+ }
+}
+
+#endif // BOOST_ENUMS_EMULATOR_TYPE_HPP

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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -12,6 +12,12 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
+/*!
+The header <boost/enums/enum_array> defines a class template for storing
+sequences of objects fixed by the size of the enumeration. We can say that
+enum_array is the counterpart of std::array when the index are enums.
+*/
+
 #ifndef BOOST_ENUMS_ENUM_ARRAY_HPP
 #define BOOST_ENUMS_ENUM_ARRAY_HPP
 
@@ -20,8 +26,8 @@
 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
 # pragma warning(push)
 # pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
-# pragma warning(disable:4510) // boost::enums::enum_array<T,N>' : default constructor could not be generated
-# pragma warning(disable:4610) // warning C4610: class 'boost::enums::enum_array<T,N>' can never be instantiated - user defined constructor required
+# pragma warning(disable:4510) // boost::enums::enum_array<T,EC>' : default constructor could not be generated
+# pragma warning(disable:4610) // warning C4610: class 'boost::enums::enum_array<T,EC>' can never be instantiated - user defined constructor required
 #endif
 
 #include <cstddef>
@@ -36,19 +42,49 @@
 
 #include <boost/enums/size.hpp>
 #include <boost/enums/pos.hpp>
-//#include <boost/tuples.hpp>
 #include <boost/type_traits/integral_constant.hpp>
 
 // FIXES for broken compilers + CONSTEXPR
 #include <boost/config.hpp>
 
-
-namespace boost {
-namespace enums {
+namespace boost
+{
+ namespace enums
+ {
+
+ /*!
+ An enum_array supports random access iterators. An instance of enum_array<T, EC>
+ stores as many elements of type T as enum literals are on the enum class EC,
+ so that size() == meta::size<EC>::value is an invariant.
+
+ The elements of an enum_array are stored contiguously, meaning that if a is an
+ enum_array<T, EC>, then it obeys the identity
+
+ &a[n] == &a[0] + n for all 0 <= n < meta::size<EC>::value.
+
+ An enum_array is an aggregate that can (????) be initialized with the syntax
+
+ enum_array a<T, EC> = { initializer-list };
+
+ where initializer-list is a comma separated list of up to meta::size<EC>::value
+ elements whose types are convertible to T.
+
+ An enum_array satisfies all of the requirements of a container and of a
+ reversible container, except that a default constructed array object is not
+ empty and that swap does not have constant complexity. An enum_array satisfies
+ 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.
+
+ 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
+ */
 
     template<class T, typename EC>
     class enum_array {
       public:
+ //! // exposition only
         T elems[meta::size<EC>::value]; // fixed-size array of elements of type T
         
       public:
@@ -63,16 +99,32 @@
         typedef EC key_type;
         typedef std::size_t size_type;
         typedef std::ptrdiff_t difference_type;
- static const std::size_t N = meta::size<EC>::value;
+ static const std::size_t static_size = meta::size<EC>::value;
+// enum { static_size = static_size };
+ /*!
+ The conditions for an aggregate are met. Class enum_array relies on
+ the implicitly-declared special member functions to conform to the
+ container requirements
+ */
 
         // iterator support
+ //! Returns: iterator for the first element
+ //! Throws: will not throw
         iterator begin() { return elems; }
+
+ //! Returns: const iterator for the first element
+ //! Throws: will not throw
         const_iterator begin() const { return elems; }
         const_iterator cbegin() const { return elems; }
         
- iterator end() { return elems+N; }
- const_iterator end() const { return elems+N; }
- const_iterator cend() const { return elems+N; }
+ //! Returns: iterator for position after the last element
+ //! Throws: will not throw
+ iterator end() { return elems+static_size; }
+
+ //! Returns: const iterator for position after the last element
+ //! Throws: will not throw
+ const_iterator end() const { return elems+static_size; }
+ const_iterator cend() const { return elems+static_size; }
 
         // reverse iterator support
 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
@@ -95,6 +147,7 @@
         typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
 #endif
 
+ //! Returns: reverse iterator for the first element of reverse iteration
         reverse_iterator rbegin() {
           return reverse_iterator(end());
         }
@@ -105,6 +158,7 @@
             return const_reverse_iterator(end());
         }
 
+ //! Returns: reverse iterator for position after the last element in reverse iteration
         reverse_iterator rend() {
           return reverse_iterator(begin());
         }
@@ -116,21 +170,29 @@
         }
 
         // operator[]
+ //! Requires: k'pos < static_size
+ //! Returns: reference to the element with key k
+ //! Throws: will not throw.
         reference operator[](key_type k)
         {
             size_type i = pos(k);
- BOOST_ASSERT( i < N && "out of range" );
+ BOOST_ASSERT( i < static_size && "out of range" );
             return elems[i];
         }
         
+ //! Requires: k'pos < static_size
+ //! Returns: constant reference to the element with key k
+ //! Throws: will not throw.
         const_reference operator[](key_type k) const
         {
             size_type i = pos(k);
- BOOST_ASSERT( i < N && "out of range" );
+ BOOST_ASSERT( i < static_size && "out of range" );
             return elems[i];
         }
 
         // at() with range check
+ //! Returns: element with key k
+ //! Throws: std::range_error if i >= static_size
         reference at(key_type k)
         {
           size_type i = rangecheck(k);
@@ -143,52 +205,72 @@
         }
     
         // front() and back()
+ //! Returns: reference to the first element
+ //! Throws: will not throw
         reference front()
         {
             return elems[0];
         }
         
+ //! Returns: const reference to the first element
+ //! Throws: will not throw
         const_reference front() const
         {
             return elems[0];
         }
         
+ //! Returns: reference to the last element
+ //! Throws: will not throw
         reference back()
         {
- return elems[N-1];
+ return elems[static_size-1];
         }
         
+ //! Returns: const reference to the last element
+ //! Throws: will not throw
         const_reference back() const
         {
- return elems[N-1];
+ return elems[static_size-1];
         }
 
         // size is constant
         BOOST_CONSTEXPR size_type size()
         {
- return N;
+ return static_size;
         }
+ //! Returns: false
+ //! Throws: will not throw
         static bool empty()
         {
           return false;
         }
+
+ //! Returns: linear in meta::size<EC>::value.
         BOOST_CONSTEXPR size_type max_size()
         {
- return N;
+ return static_size;
         }
- enum { static_size = N };
 
- // swap (note: linear complexity)
+
+ /*! Effects: swap_ranges(begin(), end(), y.begin())
+ Throws: Nothing unless one of the element-wise swap calls throws an exception.
+ Note: Unlike the swap function for other containers, enum_array::swap
+ takes linear time, may exit via an exception, and does not cause
+ iterators to become associated with the other container.
+ */
         void swap (enum_array<T,EC>& y)
         {
- for (size_type i = 0; i < N; ++i)
+ for (size_type i = 0; i < static_size; ++i)
                 boost::swap(elems[i],y.elems[i]);
         }
 
         // direct access to data (read-only)
+
+ //! Returns: elems.
         const T* data() const {
           return elems;
         }
+ //! Returns: elems.
         T* data() {
           return elems;
         }
@@ -207,9 +289,12 @@
 
         // A synonym for fill
         // assign one value to all elements
+ //! Effects: std::fill_n(begin(), static_size, value)
         void assign (const T& value) {
           fill ( value );
- }
+ }
+
+ //! Effects: fill_n(begin(), static_size, u)
         void fill (const T& value)
         {
             std::fill_n(begin(),size(),value);
@@ -217,8 +302,8 @@
 
         // check range (may be private because it is static)
         static size_type rangecheck (key_type k) {
- size_type i = enum_traits<key_type>::pos(k);
- if (i >= N) {
+ size_type i = enums::pos(k);
+ if (i >= static_size) {
                 std::out_of_range e("array<>: index out of range");
                 boost::throw_exception(e);
             }
@@ -230,31 +315,40 @@
 
 
     // comparisons
+ //! Returns: std::equal(x.begin(), x.end(), y.begin())
     template<class T, typename EC>
     bool operator== (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
     {
         return std::equal(x.begin(), x.end(), y.begin());
     }
+
+ //! Returns: std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end())
     template<class T, typename EC>
     bool operator< (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
     {
         return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
     }
+
+ //! Returns : !(x == y)
     template<class T, typename EC>
     bool operator!= (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
     {
         return !(x==y);
     }
+
+ //! Returns : y < x
     template<class T, typename EC>
     bool operator> (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
     {
         return y<x;
     }
+ //! Returns : !(y<x)
     template<class T, typename EC>
     bool operator<= (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
     {
         return !(y<x);
     }
+ //! Returns : !(x<y)
     template<class T, typename EC>
     bool operator>= (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
     {
@@ -262,6 +356,10 @@
     }
 
     // global swap()
+ //! Effects:
+ //! x.swap(y);
+ //! Complexity: linear in meta::size<EC>::value.
+
     template<class T, typename EC>
     inline void swap (enum_array<T,EC>& x, enum_array<T,EC>& y)
     {
@@ -270,27 +368,27 @@
 
 #if defined(__SUNPRO_CC)
 // Trac ticket #4757; the Sun Solaris compiler can't handle
-// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
+// syntax like 'T(&get_c_array(boost::array<T,static_size>& arg))[static_size]'
 //
 // We can't just use this for all compilers, because the
 // borland compilers can't handle this form.
     namespace detail {
        template <typename T, typename EC> struct c_array
        {
- typedef T type[N];
+ typedef T type[meta::size];
        };
     }
     
    // Specific for boost::enums::enum_array: simply returns its elems data member.
    template <typename T, typename EC>
- typename detail::c_array<T,N>::type& get_c_array(enum_array<T,EC>& arg)
+ typename detail::c_array<T,static_size>::type& get_c_array(enum_array<T,EC>& arg)
    {
        return arg.elems;
    }
 
    // Specific for boost::enums::enum_array: simply returns its elems data member.
    template <typename T, typename EC>
- typename const detail::c_array<T,N>::type& get_c_array(const enum_array<T,EC>& arg)
+ typename const detail::c_array<T,static_size>::type& get_c_array(const enum_array<T,EC>& arg)
    {
        return arg.elems;
    }

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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -14,7 +14,10 @@
 #define BOOST_ENUMS_ENUM_RANGE_HPP
 
 #include <boost/enums/enum_type.hpp>
-#include <boost/enums/enum_traits.hpp>
+//#include <boost/enums/enum_range_traits.hpp>
+#include <boost/enums/val.hpp>
+#include <boost/enums/pos.hpp>
+#include <boost/enums/size.hpp>
 
 
 #include <boost/iterator/iterator_facade.hpp>
@@ -33,7 +36,9 @@
         // This use of this iterator and enum_range<E>() is appreciably less
         // performant than the corresponding hand-written integer
         // loop on many compilers.
- template<typename EC, typename Traits=enum_traits<EC> >
+
+ //! enum_iterator is a model of RandomAccessIterator
+ template<typename EC /* , typename Traits=enum_range_traits<EC> */ >
         class enum_iterator
             : public boost::iterator_facade<
                         enum_iterator<EC>,
@@ -86,7 +91,7 @@
 
             reference dereference() const
             {
- return Traits::val(index_);
+ return enums::val<EC>(index_);
             }
 
             friend class ::boost::iterator_core_access;
@@ -94,35 +99,42 @@
         };
     } // namespace enums_detail
     
- template<typename EC, typename Traits=enum_traits<EC> >
+ template<typename EC/* , typename Traits=enum_range_traits<EC> */ >
     class enum_range
- : public iterator_range< enums_detail::enum_iterator<EC, Traits> >
+ : public iterator_range< enums_detail::enum_iterator<EC/*, Traits*/> >
     {
- typedef enums_detail::enum_iterator<EC, Traits> iterator_t;
+ typedef enums_detail::enum_iterator<EC/*, Traits*/> iterator_t;
         typedef iterator_range<iterator_t> base_t;
     public:
         enum_range()
- : base_t(iterator_t(Traits::first_index), iterator_t(Traits::last_index+1))
+ : base_t(iterator_t(0), iterator_t(enums::meta::size<EC>::value))
         {
         }
         enum_range(EC first, EC last)
- : base_t(iterator_t(Traits::pos(first)),
- iterator_t(Traits::pos(last)+1))
+ : base_t(iterator_t(enums::pos(first)),
+ iterator_t(enums::pos(last)+1))
         {
         }
     };
             
- template<typename EC, typename Traits >
+ //! function to generate an enum Range.
+
+ //! make_range allows treating enums as a model of the Random Access Range Concept.
+ //! It should be noted that the first and last parameters denoted a half-open range.
+ //! Requirements
+ //! - EC is a model of the Enumeration Concept.
+
+ template<typename EC /*, typename Traits*/ >
     enum_range<EC>
     make_range()
     {
- return enum_range<EC,Traits>();
+ return enum_range<EC/*,Traits*/>();
     }
- template<typename EC, typename Traits >
+ template<typename EC /*, typename Traits */ >
     enum_range<EC>
     make_range(EC first, EC last)
     {
- return enum_range<EC,Traits>(first,last);
+ return enum_range<EC /*,Traits*/ >(first,last);
     }
 
   } // namespace enums

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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -15,7 +15,10 @@
 #ifndef BOOST_ENUMS_ENUM_SET_HPP
 #define BOOST_ENUMS_ENUM_SET_HPP
 
-#include <boost/enums/enum_traits.hpp>
+//#include <boost/enums/enum_traits.hpp>
+//#include <boost/enums/val.hpp>
+#include <boost/enums/pos.hpp>
+#include <boost/enums/size.hpp>
 #include <bitset>
 #include <stdexcept>
 #include <iosfwd>
@@ -27,24 +30,35 @@
 #include <boost/config.hpp>
 
 
+//! The header <boost/enums/enum_set.hpp> defines a class template and several
+//! related functions for representing and manipulating sets of enums.
+
 namespace boost {
   namespace enums {
 
- template<typename enum_type,
- typename traits=enum_traits<enum_type> >
+ template<typename EC /*,
+ typename Traits=enum_subrange_traiter<EC>*/ >
     class enum_set
     {
     public:
+ //! Effects: Constructs an object of class enum_set<>, initializing all
+ //! enumerations to zero.
       BOOST_CONSTEXPR enum_set()
       {
       }
       //~ BOOST_CONSTEXPR
       // Need to be refactored to be a constexpr
       //~ error: constexpr constructor does not have empty body
- explicit enum_set(enum_type setting)
+ explicit enum_set(EC setting)
       {
         set(setting);
       }
+
+ //! Effects: Constructs an object of class enumset<>, initializing the
+ //! first M bit positions to the corresponding bit values in val.
+ //! M is the smaller of N and the number of bits in the value
+ //! representation of unsigned long long. If M<N, the remaining bit
+ //! positions are initialized to zero.
       BOOST_CONSTEXPR explicit enum_set(unsigned long long val)
         : bits(val)
       {
@@ -52,6 +66,24 @@
       //#if defined(__GNUC__) && (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 ))
       #if 1
       #else
+
+ //! Requires: pos <= str.size().
+ //! Throws: out_of_range if pos > str.size().
+ //! Effects: Determines the effective length rlen of the initializing
+ //! string as the smaller of n and str.size() - pos.
+ //! The function then throws invalid_argument if any of the rlen
+ //! characters in str beginning at position pos is other than zero or one.
+ //! The function uses traits::eq() to compare the character values.
+ //! Otherwise, the function constructs an object of class enum_set<EC>,
+ //! initializing the first M bit positions to values determined from the
+ //! corresponding characters in the string str. M is the smaller of N and
+ //! rlen.
+ //! An element of the constructed string has value zero if the
+ //! corresponding character in str, beginning at position pos, is 0 zero.
+ //! Otherwise, the element has the value 1. Character position pos + M - 1
+ //! corresponds to bit position zero. Subsequent decreasing character
+ //! positions correspond to increasing bit positions.
+ //! If M < N, remaining bit positions are initialized to zero.
       template<class charT, class ch_traits, class TAllocator>
         explicit enum_set(const std::basic_string<charT,ch_traits,TAllocator>& str,
                           typename std::basic_string<charT,ch_traits,TAllocator>::size_type pos = 0,
@@ -60,6 +92,8 @@
                           charT zero = charT('0'), charT one = charT('1'))
         : bits(str, pos, n, zero, one)
       {}
+
+ //! Effects: Constructs an object of class enumset<N> as if by enumset(string(str)).
       template <class charT>
         explicit enum_set(const charT* str,
                           typename std::basic_string<charT>::size_type n = std::basic_string<charT>::npos,
@@ -68,104 +102,213 @@
       {}
       #endif
 
+ //! Effects: Clears each bit in *this for which the corresponding bit in
+ //! rhs is clear, and leaves all other bits unchanged.
+ //! Returns: *this.
       enum_set &operator&=(const enum_set &rhs)
       {
         bits &= rhs.bits;
         return *this;
       }
+
+ //! Effects: Sets each bit in *this for which the corresponding bit in
+ //! rhs is set, and leaves all other bits unchanged.
+ //! Returns: *this.
       enum_set &operator|=(const enum_set &rhs)
       {
         bits |= rhs.bits;
         return *this;
       }
+
+ //! Effects: Toggles each bit in *this for which the corresponding bit in
+ //! rhs is set, and leaves all other bits unchanged.
+ //! Returns: *this.
       enum_set &operator^=(const enum_set &rhs)
       {
         bits ^= rhs.bits;
         return *this;
       }
+
+ //! Effects: Replaces each bit at position I in *this with a value determined as follows:
+ //! - If I < pos, the new value is zero;
+ //! - If I >= pos, the new value is the previous value of the bit at position I - pos.
+ //! Returns: *this.
       enum_set &operator<<=(const enum_set &rhs)
       {
         bits <<= rhs.bits;
         return *this;
       }
+
+ //! Effects: Replaces each bit at position I in *this with a value determined as follows:
+ //! - If pos >= N - I, the new value is zero;
+ //! - If pos < N - I, the new value is the previous value of the bit at position I + pos.
+ //! Returns: *this.
+
       enum_set &operator>>=(const enum_set &rhs)
       {
         bits >>= rhs.bits;
         return *this;
       }
+
+ //! Returns: A count of the number of bits set in *this.
       std::size_t count() const
       {
         return bits.count();
       }
+
+ //! Returns: N.
       BOOST_CONSTEXPR std::size_t size() const
       {
         return bits.size();
       }
- BOOST_CONSTEXPR bool operator[](enum_type testing) const
+
+ //! Requires: pos shall be valid.
+ //! Throws: nothing.
+ //! Returns: true if the bit at position pos in *this has the value one,
+ //! otherwise false.
+ BOOST_CONSTEXPR bool operator[](EC testing) const
       {
         return bits.test(to_bit(testing));
       }
+
+ //! Requires: pos shall be valid.
+ //! Throws: nothing.
+ //! Returns: An object of type enum_set<EC>::reference such that
+ //! (*this)[pos] == this->test(pos), and such that (*this)[pos] = val is
+ //! equivalent to this->set(pos, val).
+ //! Remark: For the purpose of determining the presence of a data race,
+ //! any access or update through the resulting reference potentially
+ //! accesses or modifies, respectively, the entire underlying bitset.
       //reference operator[](std::size_t pos); // for b[i];
+
+ //! Effects: Sets all bits in *this.
+ //! Returns: *this.
+
       enum_set &set()
       {
         bits.set();
         return *this;
       }
- enum_set &set(enum_type setting, bool value = true)
+
+ //! Requires: pos is valid
+ //! Throws: out_of_range if pos does not correspond to a valid bit position.
+ //! Effects: Stores a new value in the bit at position pos in *this.
+ //! If val is nonzero, the stored value is one, otherwise it is zero.
+ //! Returns: *this.
+ enum_set &set(EC setting, bool value = true)
       {
         bits.set(to_bit(setting), value);
         return *this;
       }
+
+ //! Effects: Resets all bits in *this.
+ //! Returns: *this.
       enum_set &reset()
       {
         bits.reset();
         return *this;
       }
- enum_set &reset(enum_type resetting)
+
+ //! Requires: pos is valid
+ //! Throws: out_of_range if pos does not correspond to a valid bit position.
+ //! Effects: Resets the bit at position pos in *this.
+ //! Returns: *this.
+
+ enum_set &reset(EC resetting)
       {
         bits.reset(to_bit(resetting));
         return *this;
       }
+
+ //! Effects: Toggles all bits in *this.
+ //! Returns: *this.
       enum_set &flip()
       {
         bits.flip();
         return *this;
       }
- enum_set &flip(enum_type flipping)
+
+ //! Requires: pos is valid
+ //! Throws: out_of_range if pos does not correspond to a valid bit position.
+ //! Effects: Toggles the bit at position pos in *this.
+ //! Returns: *this.
+ enum_set &flip(EC flipping)
       {
         bits.flip(to_bit(flipping));
         return *this;
       }
+
+ //! Throws: overflow_error if the integral value x corresponding to the
+ //! bits in *this cannot be represented as type unsigned long.
+ //! Returns: x.
+
       unsigned long to_ulong() const
       {
         return bits.to_ulong();
       }
+
+ //! Throws: overflow_error if the integral value x corresponding to the
+ //! bits in *this cannot be represented as type unsigned long long.
+ //! Returns: x.
+
       unsigned long long to_ullong() const
       {
         return bits.to_ulong();
       }
+
+ //! Effects: Constructs a string object of the appropriate type and
+ //! initializes it to a string of length N characters. Each character is
+ //! determined by the value of its corresponding bit position in *this.
+ //! Character position N - 1 corresponds to bit position zero.
+ //! Subsequent decreasing character positions correspond to increasing
+ //! bit positions. Bit value zero becomes the character zero, bit value
+ //! one becomes the character one.
+ //! Returns: The created object.
+// template <class charT = char,
+// class traits = char_traits<charT>,
+// class Allocator = allocator<charT> >
+// basic_string<charT, traits, Allocator>
+// to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
+
+ //! Effects: Constructs an object x of class enum_set<EC> and initializes it with *this.
+ //! Returns: x.flip().
       enum_set operator~() const
       {
         return enum_set(*this).flip();
       }
+
+ //! Requires: pos is valid
+ //! Throws: out_of_range if pos does not correspond to a valid bit position.
+ //! Returns: true if the bit at position pos in *this has the value one.
+// bool test(size_t pos);
+
+ //! Returns: count() == size()
       bool all() const
       {
         return bits.all();
       }
+
+ //! Returns: count() != 0
       bool any() const
       {
         return bits.any();
       }
+
+ //! Returns: count() == 0
       bool none() const
       {
         return bits.none();
       }
+
+ //! Returns: enum_set<EC>(*this) <<= pos.
       enum_set operator<<(std::size_t pos) const
       {
         enum_set r = *this;
         r <<= pos;
         return r;
       }
+
+ //! Returns: enum_set<EC>(*this) >>= pos.
       enum_set operator>>(std::size_t pos) const
       {
         enum_set r = *this;
@@ -173,58 +316,81 @@
         return r;
       }
 
+ //! Returns: A nonzero value if the value of each bit in *this equals the
+ //! value of the corresponding bit in rhs.
+// bool operator==(const enum_set& rhs) const;
+
+ //! Returns: A nonzero value if !(*this == rhs).
+// bool operator!=(const enum_set& rhs) const;
     private:
 
- static std::size_t to_bit(enum_type value)
+ static std::size_t to_bit(EC value)
       {
- return traits::pos(value);
+ return enums::pos(value);
       }
 
- std::bitset<traits::size> bits;
+ std::bitset<enums::meta::size<EC>::value> bits;
 
     public:
 
- std::bitset<traits::size+1> detail_bits() { return bits; }
+ std::bitset<enums::meta::size<EC>::value> detail_bits() { return bits; }
     };
 
     // enum_set operators:
- 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)
+
+ //! 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)
     {
- enum_set<enum_type,traits> r = x;
+ enum_set<EC/*,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)
+ //! 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)
     {
- enum_set<enum_type,traits> r = x;
+ enum_set<EC/*,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)
+ //! 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)
     {
- enum_set<enum_type,traits> r = x;
+ enum_set<EC/*,Traits*/> r = x;
       r ^= y;
       return r;
     }
 
-
- template <class charT, class ch_traits, typename enum_type, typename traits >
+ //! A formatted input function.
+ //! Effects: Extracts up to N characters from is. Stores these characters
+ //! in a temporary object str of type basic_string<charT, traits>, then
+ //! evaluates the expression x = enum_set<EC>(str). Characters are extracted
+ //! and stored until any of the following occurs:
+ //! - N characters have been extracted and stored;
+ //! - end-of-file occurs on the input sequence;
+ //! - the next input character is neither is.widen(’0’) nor is.widen(’1’)
+ //! (in which case the input character is not extracted).
+ //! If no characters are stored in str, calls is.setstate(ios_base::failbit)
+ //! (which may throw ios_- base::failure).
+ //! Returns: 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<enum_type,traits>& x)
+ operator>>(std::basic_istream<charT, ch_traits>& is, enum_set<EC/*,Traits*/>& x)
     {
       return is >> x.detail_bits();
     }
 
-
- template <class charT, class ch_traits, typename enum_type, typename traits >
+ //! Returns:
+ //! 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’))
+ template <class charT, class ch_traits, typename EC/*, 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<EC/*,Traits*/>& x)
     {
       return os << x.detail_bits();
     }
@@ -232,13 +398,14 @@
 
   } /* namespace enums */
 
- 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>
+ //! Requires: the template specialization shall meet the requirements of class template hash.
+ template <typename EC/*, typename Traits*/ >
+ struct hash<enums::enum_set<EC/*,Traits*/> >
+ : public std::unary_function<enums::enum_set<EC/*,Traits*/>, std::size_t>
   {
- std::size_t operator()(const enums::enum_set<enum_type,traits>& bs) const
+ std::size_t operator()(const enums::enum_set<EC/*,Traits*/>& bs) const
     {
- return hash<std::bitset<traits::size> >(bs.detail_bits());
+ return hash<std::bitset<enums::meta::size<EC>::size> >(bs.detail_bits());
     }
   };
 

Added: sandbox/enums/boost/enums/enum_subrange_traiter.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_subrange_traiter.hpp 2011-03-12 13:51:05 EST (Sat, 12 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_RANGE_TRAITER_HPP
+#define BOOST_ENUMS_ENUM_RANGE_TRAITER_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_traiter
+ {
+ 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_RANGE_TRAITER_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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -23,41 +23,51 @@
 
 namespace boost {
   namespace enums {
- template <typename EC,
- std::size_t Last=meta::size<EC>::value-1,
- std::size_t First=0
- >
- struct enum_traiter
- {
- typedef EC enum_type;
- static const std::size_t first_index = First;
- static const std::size_t last_index = Last;
- static const std::size_t size = Last-First+1;
 
- static EC first()
- {
- return boost::convert_to<EC>(meta::val<EC,First>::value);
- }
- static EC last()
- {
- return boost::convert_to<EC>(meta::val<EC,Last>::value);
- }
-
- };
- template <typename EC>
- struct linear_enum_traiter : enum_traiter<EC>
+ template <
+ typename EC
+ >
+ struct linear_enum_traiter
     {
- typedef enum_traiter<EC> base_type;
- static std::size_t pos(EC e)
+ protected:
+ BOOST_STATIC_CONSTEXPR typename underlying_type<EC>::type first_value =
+ static_cast<typename underlying_type<EC>::type>(
+ enums::meta::val<EC,0>::value
+ );
+ BOOST_STATIC_CONSTEXPR typename underlying_type<EC>::type last_value =
+ static_cast<typename underlying_type<EC>::type>(
+ enums::meta::val<EC,meta::size<EC>::value-1>::value
+ );
+ BOOST_STATIC_CONSTEXPR std::size_t step = (last_value-first_value)/(meta::size<EC>::value-1);
+ public:
+ static std::size_t pos(EC e)
       {
- return (get_value(e)-base_type::first_index);
- }
- static EC val(std::size_t i)
+ typename underlying_type<EC>::type ut = static_cast<typename underlying_type<EC>::type>(get_value(e));
+ return (ut-first_value)/step;
+ }
+ static EC val(std::size_t i)
       {
- typename underlying_type<EC>::type ut = i+base_type::first_index;
+ typename underlying_type<EC>::type ut = i*step+first_value;
         return boost::convert_to<EC>(ut);
- }
+ }
     };
+
+// template <
+// typename EC
+// >
+// struct log2_enum_traiter
+// {
+// public:
+// static std::size_t pos(EC e)
+// {
+// return (get_value(e));
+// }
+// static EC val(std::size_t i)
+// {
+// typename underlying_type<EC>::type ut = 1<<i;
+// return boost::convert_to<EC>(ut);
+// }
+// };
   }
 }
 

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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -14,11 +14,13 @@
 #define BOOST_ENUMS_ENUM_TRAITS_HPP
 
 namespace boost {
- namespace enums {
+namespace enums {
+namespace meta {
     template <typename EC>
     struct enum_traits;
 
- }
+}
+}
 }
 
 #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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -15,9 +15,12 @@
 
 #include <boost/config.hpp>
 
-namespace boost {
- namespace enums {
-
+namespace boost
+{
+ namespace enums
+ {
+ //! meta-function to get the native enum type associated to an enum class
+ //! or its emulation
     template <typename EC>
     struct enum_type
     {

Modified: sandbox/enums/boost/enums/first.hpp
==============================================================================
--- sandbox/enums/boost/enums/first.hpp (original)
+++ sandbox/enums/boost/enums/first.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -16,19 +16,25 @@
 #include <boost/enums/enum_type.hpp>
 #include <boost/enums/val.hpp>
 
-namespace boost {
- namespace enums {
- namespace meta {
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ //! meta-function: first element of an enumeration
       template <typename EC>
       struct first
       {
         BOOST_STATIC_CONSTEXPR typename enum_type<EC>::type value = enums::meta::val<EC,0>::value;
       };
     }
+ //! Returns the the first element of an enumeration
+ //! Throws: Nothing
     template <typename EC>
     BOOST_CONSTEXPR EC first()
     {
- return meta::val<EC,0>::value;
+ return meta::first<EC>::value;
     }
   }
 }

Modified: sandbox/enums/boost/enums/last.hpp
==============================================================================
--- sandbox/enums/boost/enums/last.hpp (original)
+++ sandbox/enums/boost/enums/last.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -17,15 +17,21 @@
 #include <boost/enums/val.hpp>
 #include <boost/enums/size.hpp>
 
-namespace boost {
- namespace enums {
- namespace meta {
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ //! meta-function: first element of an enumeration
       template <typename EC>
       struct last
       {
         BOOST_STATIC_CONSTEXPR typename enum_type<EC>::type value = val<EC,size<EC>::value-1>::value;
       };
     }
+ //! Returns the the last element of an enumeration
+ //! Throws: Nothing
     template <typename EC>
     BOOST_CONSTEXPR EC last()
     {

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/O1_size.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/O1_size.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,33 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_O1_SIZE_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_O1_SIZE_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/O1_size.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/mpl/O1_size_fwd.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/size.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+
+namespace boost { namespace mpl {
+
+template<>
+struct O1_size_impl< aux::half_open_enum_range_tag >
+ : size_impl< aux::half_open_enum_range_tag >
+{
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_O1_SIZE_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/back.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/back.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,37 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_BACK_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_BACK_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/back.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/mpl/back_fwd.hpp>
+#include <boost/mpl/prior.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+
+namespace boost { namespace mpl {
+
+template<>
+struct back_impl< aux::half_open_enum_range_tag >
+{
+ template< typename Range > struct apply
+ {
+ typedef typename deref<typename prior< typename Range::end >::type>::type type;
+ };
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_BACK_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/empty.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/empty.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,39 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_EMPTY_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_EMPTY_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/empty.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/mpl/empty_fwd.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+
+namespace boost { namespace mpl {
+
+template<>
+struct empty_impl< aux::half_open_enum_range_tag >
+{
+ template< typename Range > struct apply
+ : equal_to<
+ typename Range::begin::position
+ , typename Range::end::position
+ >
+ {
+ };
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_EMPTY_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/front.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/front.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,35 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_FRONT_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_FRONT_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/front.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/mpl/front_fwd.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+
+namespace boost { namespace mpl {
+
+template<>
+struct front_impl< aux::half_open_enum_range_tag >
+{
+ template< typename Range > struct apply
+ {
+ typedef typename Range::start type;
+ };
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_FRONT_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/iterator.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,127 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_ITERATOR_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_ITERATOR_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/iterator.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/mpl/iterator_tags.hpp>
+#include <boost/mpl/advance_fwd.hpp>
+#include <boost/mpl/distance_fwd.hpp>
+#include <boost/mpl/next_prior.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/minus.hpp>
+#include <boost/mpl/aux_/value_wknd.hpp>
+#include <boost/mpl/aux_/config/ctps.hpp>
+#include <boost/enums/size.hpp>
+#include <boost/enums/val.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+#include <boost/mpl/integral_c.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+
+namespace boost { namespace mpl {
+
+template <
+ typename EC, typename N
+> struct lazy_enum_c
+{
+ typedef enum_c<EC,enums::meta::val<EC,N::value>::value> type;
+};
+
+// theoretically will work on any discrete numeric type
+template< typename EC, typename N > struct enum_r_iter
+{
+ typedef aux::enum_r_iter_tag tag;
+ typedef random_access_iterator_tag category;
+ typedef EC enum_type;
+ typedef N position;
+ typedef typename eval_if<
+ equal_to<N,integral_c<std::size_t, enums::meta::size<EC>::value> >,
+ identity<void>,
+ lazy_enum_c<EC,N>
+ >::type type;
+
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ typedef enum_r_iter< EC, typename mpl::next<N>::type > next;
+ typedef enum_r_iter< EC, typename mpl::prior<N>::type > prior;
+#endif
+};
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+
+template<
+ typename EC, typename N
+ >
+struct next< enum_r_iter<EC,N> >
+{
+ typedef enum_r_iter< EC, typename mpl::next<N>::type > type;
+};
+
+template<
+ typename EC, typename N
+ >
+struct prior< enum_r_iter<EC,N> >
+{
+ typedef enum_r_iter< EC, typename mpl::prior<N>::type > type;
+};
+
+#endif
+
+
+template<> struct advance_impl<aux::enum_r_iter_tag>
+{
+ template< typename Iter, typename Dist > struct apply
+ {
+ typedef typename Iter::position n_;
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+ typedef typename plus_impl<integral_c_tag,integral_c_tag>
+ ::template apply<n_,Dist>::type m_;
+#else
+ typedef typename plus<n_,Dist>::type m_;
+#endif
+ // agurt, 10/nov/04: to be generic, the code have to do something along
+ // the lines below...
+ //
+ // typedef typename apply_wrap1<
+ // numeric_cast< typename m_::tag, typename n_::tag >
+ // , m_
+ // >::type result_;
+ //
+ // ... meanwhile:
+
+ typedef integral_c<
+ typename aux::value_type_wknd<n_>::type
+ , BOOST_MPL_AUX_VALUE_WKND(m_)::value
+ > result_;
+
+ typedef enum_r_iter<typename Iter::enum_type, result_> type;
+ };
+};
+
+template<> struct distance_impl<aux::enum_r_iter_tag>
+{
+ template< typename Iter1, typename Iter2 > struct apply
+ : minus<
+ typename Iter2::position
+ , typename Iter1::position
+ >
+ {
+ };
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_ITERATOR_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/size.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/size.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,40 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_SIZE_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_SIZE_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/size.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+#include <boost/mpl/size_fwd.hpp>
+#include <boost/mpl/minus.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+
+namespace boost { namespace mpl {
+
+template<>
+struct size_impl< aux::half_open_enum_range_tag >
+{
+ template< typename Range > struct apply
+ : minus<
+ typename Range::end::position
+ , typename Range::begin::position
+ >
+ {
+ };
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_SIZE_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/aux_/enum_range_c/tag.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/aux_/enum_range_c/tag.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,26 @@
+
+#ifndef BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_TAG_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_TAG_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/aux_/tag.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+namespace boost { namespace mpl { namespace aux {
+
+struct half_open_enum_range_tag;
+struct enum_r_iter_tag;
+
+}}}
+
+#endif // BOOST_ENUMS_MPL_AUX_ENUM_RANGE_C_TAG_HPP_INCLUDED

Added: sandbox/enums/boost/enums/mpl/enum_range_c.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/mpl/enum_range_c.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -0,0 +1,54 @@
+
+#ifndef BOOST_ENUMS_MPL_ENUM_RANGE_C_HPP_INCLUDED
+#define BOOST_ENUMS_MPL_ENUM_RANGE_C_HPP_INCLUDED
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+// Based on boost/mpl/range_c.hpp
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/enums/mpl/enum_c.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/front.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/back.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/size.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/O1_size.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/empty.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/iterator.hpp>
+#include <boost/enums/mpl/aux_/enum_range_c/tag.hpp>
+#include <boost/enums/size.hpp>
+#include <boost/enums/val.hpp>
+#include <boost/mpl/integral_c.hpp>
+#include <cstddef>
+
+namespace boost { namespace mpl {
+
+template<
+ typename EC
+ , std::size_t Start=0
+ , std::size_t Finish=enums::meta::size<EC>::value
+ >
+struct enum_range_c
+{
+ typedef aux::half_open_enum_range_tag tag;
+ typedef EC value_type;
+ typedef enum_range_c type;
+
+ typedef enum_c<EC, enums::meta::val<EC, Start>::value> start;
+ //typedef enum_c<EC, enums::meta::val<EC, Finish>::value> finish;
+
+ typedef enum_r_iter<EC,integral_c<std::size_t, Start> > begin;
+ typedef enum_r_iter<EC,integral_c<std::size_t, Finish> > end;
+};
+
+}}
+
+#endif // BOOST_ENUMS_MPL_ENUM_RANGE_C_HPP_INCLUDED

Modified: sandbox/enums/boost/enums/pos.hpp
==============================================================================
--- sandbox/enums/boost/enums/pos.hpp (original)
+++ sandbox/enums/boost/enums/pos.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -18,16 +18,27 @@
 #include <cstddef>
 
 
-namespace boost {
- namespace enums {
- namespace meta {
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ //! meta-function used to associate the an element of an enumeration to
+ //! its relative position.
+ //! This meta-function must be specialized for each element of the enumeration.
       template <typename EC, typename enum_type<EC>::type V>
       struct pos;
     }
+
+ //! Returns: the associated position
+ //! The enum_traits class must be specialized and contain a pos function
+ //! that returns the relative position.
+ //! Throws: Nothing
     template <typename EC>
     std::size_t pos(EC e)
     {
- return enum_traits<EC>::pos(e);
+ return meta::enum_traits<EC>::pos(e);
     }
 
   }

Modified: sandbox/enums/boost/enums/pred.hpp
==============================================================================
--- sandbox/enums/boost/enums/pred.hpp (original)
+++ sandbox/enums/boost/enums/pred.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -19,9 +19,14 @@
 #include <boost/static_assert.hpp>
 #include <boost/assert.hpp>
 
-namespace boost {
- namespace enums {
- namespace meta {
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ //! meta-function that gets the predecessor of an enumeration element
+ //! Pre-condition: the position must be not 0
       template <typename EC, typename enum_type<EC>::type V>
       struct pred
       {
@@ -30,6 +35,9 @@
           val<EC,pos<EC,V>::value-1>::value;
       };
     }
+
+ //! Returns: the predecessor of the enumeration element
+ //! Throws: Invalid parameter if the position is 0
     template <typename EC>
     BOOST_CONSTEXPR EC pred(EC e)
     {

Modified: sandbox/enums/boost/enums/succ.hpp
==============================================================================
--- sandbox/enums/boost/enums/succ.hpp (original)
+++ sandbox/enums/boost/enums/succ.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -19,9 +19,14 @@
 #include <boost/static_assert.hpp>
 #include <boost/assert.hpp>
 
-namespace boost {
- namespace enums {
- namespace meta {
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ //! meta-function that gets the successor of an enumeration element
+ //! Pre-condition: the position must not be the last one
       template <typename EC, typename enum_type<EC>::type V>
       struct succ
       {
@@ -30,6 +35,9 @@
           val<EC,pos<EC,V>::value+1>::value;
       };
     }
+
+ //! Returns: the successor of the enumeration element
+ //! Throws: Invalid parameter if the position is the last one
     template <typename EC>
     EC succ(EC e)
     {

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-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -13,23 +13,31 @@
 #ifndef BOOST_ENUMS_UNDERLYING_TYPE_HPP
 #define BOOST_ENUMS_UNDERLYING_TYPE_HPP
 
-#include <boost/config.hpp>
-#ifndef BOOST_NO_SCOPED_ENUMS
-#include <type_traits>
+#include <boost/enums/config.hpp>
+#ifndef BOOST_NO_UNDERLYING_TYPE
+ #include <type_traits>
 #endif
 
-namespace boost {
- namespace enums {
+namespace boost
+{
+ namespace enums
+ {
+
+ //! T must be an enumeration type or the emulation of a enum class.
+ //! The member typedef type name the underlying type of T.
+ //! This meta-function must be specialized for the compilers providing enum
+ //! class but don't providing the std::underlying_type meta-function.
     template <typename EC>
     struct underlying_type
     {
-#ifdef BOOST_NO_SCOPED_ENUMS
- typedef typename EC::underlying_type type;
-#else
- //~ typedef std::underlying_type<EC>::type type;
-#endif
+ #ifdef BOOST_NO_SCOPED_ENUMS
+ typedef typename EC::underlying_type type;
+ #else
+ #ifndef BOOST_NO_UNDERLYING_TYPE
+ typedef std::underlying_type<EC>::type type;
+ #endif
+ #endif
     };
-
   }
 }
 

Modified: sandbox/enums/boost/enums/val.hpp
==============================================================================
--- sandbox/enums/boost/enums/val.hpp (original)
+++ sandbox/enums/boost/enums/val.hpp 2011-03-12 13:51:05 EST (Sat, 12 Mar 2011)
@@ -18,17 +18,25 @@
 #include <boost/assert.hpp>
 #include <cstddef>
 
-namespace boost {
- namespace enums {
- namespace meta {
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ //! meta-function used to associate the position to an element of an enumeration.
+ //! 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>
       struct val;
     }
+ //! Returns: The enum class element associated to the position
+ //! Throws: Invalid parameter if the position is out of range
     template <typename EC>
     EC val(std::size_t p)
     {
       BOOST_ASSERT(p<(meta::size<EC>::value));
- return enum_traits<EC>::val(p);
+ return meta::enum_traits<EC>::val(p);
     }
 
   }


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