Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69451 - sandbox/enums/boost/enums
From: vicente.botet_at_[hidden]
Date: 2011-03-01 18:42:56


Author: viboes
Date: 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
New Revision: 69451
URL: http://svn.boost.org/trac/boost/changeset/69451

Log:
Enums: Add metadata so Enums can be used as range
Added:
   sandbox/enums/boost/enums/enum_range.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_traiter.hpp (contents, props changed)
   sandbox/enums/boost/enums/enum_traits.hpp (contents, props changed)
   sandbox/enums/boost/enums/first.hpp (contents, props changed)
   sandbox/enums/boost/enums/last.hpp (contents, props changed)
   sandbox/enums/boost/enums/pos.hpp (contents, props changed)
   sandbox/enums/boost/enums/size.hpp (contents, props changed)
   sandbox/enums/boost/enums/val.hpp (contents, props changed)
Text files modified:
   sandbox/enums/boost/enums/emulation.hpp | 145 ++++++++++++++++++++++++++++++++-------
   sandbox/enums/boost/enums/get_value.hpp | 7 +
   sandbox/enums/boost/enums/include.hpp | 13 +++
   3 files changed, 133 insertions(+), 32 deletions(-)

Modified: sandbox/enums/boost/enums/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulation.hpp (original)
+++ sandbox/enums/boost/enums/emulation.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -38,6 +38,56 @@
 
 #endif
 
+
+#ifndef BOOST_NO_SCOPED_ENUMS
+ #if defined(__GNUC__) && (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 5 ))
+
+ #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP) \
+ inline bool operator OP(EC lhs, EC rhs) { \
+ return (boost::enums::underlying_type<EC>::type)(lhs) \
+ OP \
+ (boost::enums::underlying_type<EC>::type)(rhs); \
+ }
+ #if 0
+ bool operator OP(boost::enums::enum_type<EC>::type lhs, EC rhs) { \
+ return lhs OP \
+ (boost::enums::underlying_type<EC>::type)(rhs); \
+ } \
+ bool operator OP(EC lhs, type rhs) { \
+ return (boost::enums::underlying_type<EC>::type)(lhs) OP rhs; \
+ }
+ #endif
+
+ #else
+
+ #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP)
+
+ #endif
+
+#else
+
+ #define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP) \
+ friend inline bool operator OP(EC lhs, EC rhs) { \
+ return lhs.get() OP rhs.get(); \
+ } \
+ friend inline bool operator OP(type lhs, EC rhs) { \
+ return lhs OP rhs.get(); \
+ } \
+ friend inline bool operator OP(EC lhs, type rhs) { \
+ return lhs.get() OP rhs; \
+ }
+
+#endif
+
+#define BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT) \
+ BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, ==) \
+ BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, !=) \
+ BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, <) \
+ BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, <=) \
+ BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, >) \
+ BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, >=)
+
+
 #ifndef BOOST_NO_SCOPED_ENUMS
 
   #ifdef BOOST_NO_UNDERLYING_TYPE
@@ -59,6 +109,28 @@
 
   #endif // BOOST_NO_UNDERLYING_TYPE
 
+ #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ inline EC convert_to(boost::enums::underlying_type<EC>::type v \
+ , boost::dummy::type_tag<EC> const& \
+ ) \
+ { \
+ return EC(v); \
+ } \
+ inline EC convert_to(boost::enums::enum_type<EC>::type v \
+ , boost::dummy::type_tag<EC> const& \
+ ) \
+ { \
+ return v; \
+ } \
+ inline boost::enums::underlying_type<EC>::type convert_to(EC v \
+ , boost::dummy::type_tag<boost::enums::underlying_type<EC>::type> const& \
+ ) \
+ { \
+ return (boost::enums::underlying_type<EC>::type)(boost::enums::get_value(v) ); \
+ }
+
+
+
   #define BOOST_ENUM_CLASS_START(EC, UT) \
     enum class EC : UT
 
@@ -67,24 +139,32 @@
 
   #define BOOST_ENUM_CLASS_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(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_UNDERLYING_TYPE_SPEC(EC, UT) \
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
- #define BOOST_ENUM_CLASS_CONS_END(EC, UT) \
+ #define BOOST_ENUM_CLASS_CONS_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(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) \
+ #define BOOST_ENUM_TYPE_CONS_END(EC, UT) \
     ; \
- BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT)
+ BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
 #else // BOOST_NO_SCOPED_ENUMS
 
   #define BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
- EC() : val_() { } \
+ EC() : val_(type()) { } \
     EC(type v) : val_(v) { }
 
   #define BOOST_ENUMS_DETAIL_CONSTRUCTORS_AUX() \
@@ -116,6 +196,34 @@
     public:
 
 
+
+ #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ inline EC convert_to(boost::enums::underlying_type<EC>::type v \
+ , boost::dummy::type_tag<EC> const& \
+ ) \
+ { \
+ return EC::convert_to(v); \
+ } \
+ inline EC convert_to(boost::enums::enum_type<EC>::type v \
+ , boost::dummy::type_tag<EC> const& \
+ ) \
+ { \
+ 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& \
+ ) \
+ { \
+ return (boost::enums::underlying_type<EC>::type)(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); \
+ }
+
+
   #define BOOST_ENUMS_END_2(EC, UT) \
       EC& operator =(type rhs) { \
         val_=rhs; \
@@ -124,7 +232,7 @@
       static EC default_value() \
       { \
         EC res; \
- res.val_=EnumClass::type(); \
+ res.val_=EC::type(); \
         return res; \
       } \
       static EC convert_to(underlying_type v) \
@@ -143,26 +251,9 @@
       { \
         return type(val_); \
       } \
- friend bool operator ==(EC lhs, EC rhs) { \
- return lhs.get()==rhs.get(); \
- } \
- friend bool operator ==(type lhs, EC rhs) { \
- return lhs==rhs.get(); \
- } \
- friend bool operator ==(EC lhs, type rhs) { \
- return lhs.get()==rhs; \
- } \
- friend bool operator !=(EC lhs, EC rhs) { \
- return lhs.get()!=rhs.get(); \
- } \
- friend bool operator !=(EC lhs, type rhs) { \
- return lhs.get()!=rhs; \
- } \
- friend bool operator !=(type lhs, EC rhs) { \
- return lhs!=rhs.get(); \
- } \
+ BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)\
     }; \
-
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT)
 
   #define BOOST_ENUM_CLASS_END(EC, UT) \
     BOOST_ENUMS_END_1(EC, UT) \

Added: sandbox/enums/boost/enums/enum_range.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_range.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,131 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_HPP
+#define BOOST_ENUMS_ENUM_RANGE_HPP
+
+#include <boost/enums/enum_type.hpp>
+#include <boost/enums/enum_traits.hpp>
+
+
+#include <boost/iterator/iterator_facade.hpp>
+#include <boost/range/iterator_range.hpp>
+
+namespace boost {
+ namespace enums {
+ namespace enums_detail {
+ // enum_iterator is an iterator over an enum that
+ // is bounded only by the limits of the enum.
+ //
+ // This is useful for implementing the enum_range<E>()
+ // function.
+ //
+ // Note:
+ // 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> >
+ class enum_iterator
+ : public boost::iterator_facade<
+ enum_iterator<EC>,
+ EC,
+ boost::random_access_traversal_tag,
+ EC,
+ std::ptrdiff_t
+ >
+ {
+ typedef boost::iterator_facade<
+ enum_iterator<EC>,
+ EC,
+ boost::random_access_traversal_tag,
+ EC,
+ std::ptrdiff_t
+ > base_t;
+ public:
+ typedef typename base_t::value_type value_type;
+ typedef typename base_t::difference_type difference_type;
+ typedef typename base_t::reference reference;
+
+ enum_iterator() : index_(0) {}
+ explicit enum_iterator(int x) : index_(x) {}
+
+ private:
+ void increment()
+ {
+ ++index_;
+ }
+
+ void decrement()
+ {
+ --index_;
+ }
+
+ void advance(difference_type offset)
+ {
+ index_ += offset;
+ }
+
+ difference_type distance_to(const enum_iterator& other) const
+ {
+ return other.index_ - index_;
+ }
+
+ bool equal(const enum_iterator& other) const
+ {
+ return index_ == other.index_;
+ }
+
+ reference dereference() const
+ {
+ return Traits::val(index_);
+ }
+
+ friend class ::boost::iterator_core_access;
+ int index_;
+ };
+ } // namespace enums_detail
+
+ template<typename EC, typename Traits=enum_traits<EC> >
+ class enum_range
+ : public iterator_range< enums_detail::enum_iterator<EC, Traits> >
+ {
+ 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))
+ {
+ }
+ enum_range(EC first, EC last)
+ : base_t(iterator_t(Traits::pos(first)),
+ iterator_t(Traits::pos(last)+1))
+ {
+ }
+ };
+
+ template<typename EC, typename Traits >
+ enum_range<EC>
+ make_range()
+ {
+ return enum_range<EC,Traits>();
+ }
+ template<typename EC, typename Traits >
+ enum_range<EC>
+ make_range(EC first, EC last)
+ {
+ return enum_range<EC,Traits>(first,last);
+ }
+
+ } // namespace enums
+} // namespace boost
+
+#endif

Added: sandbox/enums/boost/enums/enum_traiter.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_traiter.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,64 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_TRAITER_HPP
+#define BOOST_ENUMS_ENUM_TRAITER_HPP
+
+#include <boost/enums/enum_type.hpp>
+#include <boost/enums/size.hpp>
+#include <boost/enums/val.hpp>
+#include <boost/enums/pos.hpp>
+#include <boost/enums/first.hpp>
+#include <boost/enums/last.hpp>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+ namespace enums {
+ template <typename EC,
+ int Last=enums::meta::size<EC>::value-1,
+ int First=0
+ >
+ struct enum_traiter
+ {
+ typedef EC enum_type;
+ static const int first_index = First;
+ static const int last_index = Last;
+ static const int size = Last-First+1;
+
+ static EC first()
+ {
+ return boost::convert_to<EC>(enums::meta::val<EC,First>::value);
+ }
+ static EC last()
+ {
+ return boost::convert_to<EC>(enums::meta::val<EC,Last>::value);
+ }
+
+ };
+ template <typename EC>
+ struct linear_enum_traiter : enum_traiter<EC>
+ {
+ typedef enum_traiter<EC> base_type;
+ static int pos(EC e)
+ {
+ return (enums::get_value(e)-base_type::first_index);
+ }
+ static EC val(int i)
+ {
+ typename enums::underlying_type<EC>::type ut = i+base_type::first_index;
+ return boost::convert_to<EC>(ut);
+ }
+ };
+ }
+}
+
+#endif

Added: sandbox/enums/boost/enums/enum_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/enum_traits.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,24 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_TRAITS_HPP
+#define BOOST_ENUMS_ENUM_TRAITS_HPP
+
+namespace boost {
+ namespace enums {
+ template <typename EC>
+ struct enum_traits;
+
+ }
+}
+
+#endif

Added: sandbox/enums/boost/enums/first.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/first.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,31 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_FIRST_HPP
+#define BOOST_ENUMS_FIRST_HPP
+
+#include <boost/enums/enum_type.hpp>
+#include <boost/enums/val.hpp>
+
+namespace boost {
+ namespace enums {
+ namespace meta {
+ template <typename EC>
+ struct first
+ {
+ static const typename enum_type<EC>::type value = enums::meta::val<EC,0>::value;
+ };
+ }
+ }
+}
+
+#endif

Modified: sandbox/enums/boost/enums/get_value.hpp
==============================================================================
--- sandbox/enums/boost/enums/get_value.hpp (original)
+++ sandbox/enums/boost/enums/get_value.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -15,7 +15,7 @@
 
 #include <boost/config.hpp>
 #include <boost/enums/enum_type.hpp>
-
+#include <iostream>
 namespace boost {
   namespace enums {
 
@@ -25,9 +25,10 @@
     get_value(EC e)
     {
 #ifdef BOOST_NO_SCOPED_ENUMS
- return e.get();
+ std::cout << __LINE__ << std::endl;
+ return e.get();
 #else
- return e;
+ std::cout << __LINE__ << std::endl; return e;
 #endif
     }
   }

Modified: sandbox/enums/boost/enums/include.hpp
==============================================================================
--- sandbox/enums/boost/enums/include.hpp (original)
+++ sandbox/enums/boost/enums/include.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -14,9 +14,18 @@
 #define BOOST_ENUMS_INCLUDE_HPP
 
 #include <boost/enums/default_value.hpp>
-#include <boost/enums/underlying_type.hpp>
+#include <boost/enums/emmulation.hpp>
+#include <boost/enums/enum_range.hpp>
+#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/emmulation.hpp>
+#include <boost/enums/first.hpp>
+#include <boost/enums/last.hpp>
+#include <boost/enums/pos.hpp>
+#include <boost/enums/size.hpp>
+#include <boost/enums/underlying_type.hpp>
+#include <boost/enums/val.hpp>
+
     
 #endif

Added: sandbox/enums/boost/enums/last.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/last.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,32 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_LAST_HPP
+#define BOOST_ENUMS_LAST_HPP
+
+#include <boost/enums/enum_type.hpp>
+#include <boost/enums/val.hpp>
+#include <boost/enums/size.hpp>
+
+namespace boost {
+ namespace enums {
+ namespace meta {
+ template <typename EC>
+ struct last
+ {
+ static const typename enum_type<EC>::type value = enums::meta::val<EC,enums::meta::size<EC>::value-1>::value;
+ };
+ }
+ }
+}
+
+#endif

Added: sandbox/enums/boost/enums/pos.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/pos.hpp 2011-03-01 18:42:53 EST (Tue, 01 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_POS_HPP
+#define BOOST_ENUMS_POS_HPP
+
+#include <boost/enums/enum_type.hpp>
+#include <boost/enums/enum_traits.hpp>
+
+
+namespace boost {
+ namespace enums {
+ namespace meta {
+ template <typename EC, typename enum_type<EC>::type V>
+ struct pos;
+ }
+ template <typename EC>
+ int pos(EC e)
+ {
+ return enum_traits<EC>::pos(e);
+ }
+
+ }
+}
+
+#endif

Added: sandbox/enums/boost/enums/size.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/size.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,32 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_SIZE_HPP
+#define BOOST_ENUMS_SIZE_HPP
+
+#include <boost/enums/enum_type.hpp>
+
+
+namespace boost {
+ namespace enums {
+ namespace meta {
+ template <typename EC>
+ struct size;
+ }
+ //{
+ // typename int value = ...;
+ //};
+
+ }
+}
+
+#endif

Added: sandbox/enums/boost/enums/val.hpp
==============================================================================
--- (empty file)
+++ sandbox/enums/boost/enums/val.hpp 2011-03-01 18:42:53 EST (Tue, 01 Mar 2011)
@@ -0,0 +1,33 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_VALUE_HPP
+#define BOOST_ENUMS_VALUE_HPP
+
+#include <boost/enums/enum_traits.hpp>
+
+namespace boost {
+ namespace enums {
+ namespace meta {
+ template <typename EC, int I>
+ struct val;
+ }
+ template <typename EC>
+ EC val(int p)
+ {
+ return enum_traits<EC>::val(p);
+ }
+
+ }
+}
+
+#endif


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