Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70538 - in sandbox/enums/boost/enums: pp scoped
From: vicente.botet_at_[hidden]
Date: 2011-03-24 21:25:01


Author: viboes
Date: 2011-03-24 21:25:00 EDT (Thu, 24 Mar 2011)
New Revision: 70538
URL: http://svn.boost.org/trac/boost/changeset/70538

Log:
Enums:
Text files modified:
   sandbox/enums/boost/enums/pp/enum_declaration.hpp | 218 ++++++++++++++++++++-------------------
   sandbox/enums/boost/enums/pp/namespaces.hpp | 82 +++++++++-----
   sandbox/enums/boost/enums/scoped/emulation.hpp | 63 ++++++----
   3 files changed, 199 insertions(+), 164 deletions(-)

Modified: sandbox/enums/boost/enums/pp/enum_declaration.hpp
==============================================================================
--- sandbox/enums/boost/enums/pp/enum_declaration.hpp (original)
+++ sandbox/enums/boost/enums/pp/enum_declaration.hpp 2011-03-24 21:25:00 EDT (Thu, 24 Mar 2011)
@@ -25,8 +25,8 @@
 
  @brief enum-declaration associated macros.
 
-
- */
+
+ */
 
 #define BOOST_ENUMS_ENUM_DCL_STR_TO_ID(P, ENUM, ED) \
   if (strcmp( \
@@ -40,12 +40,12 @@
   }
 
 #define BOOST_ENUMS_ENUM_DCL_ID_TO_STR(P, ENUM, ED) \
- case ENUM::ENUM::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED) : \
+ case ENUM::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED) : \
     return(BOOST_ENUMS_ENUMERATOR_DEFINITION_STR(ED));
 
 
 #define BOOST_ENUMS_DCL_STRING_CONVERSIONS(ENUM, EL) \
- inline friend \
+ inline \
   ENUM convert_to( \
       const char* str, \
       boost::dummy::type_tag<ENUM> const& \
@@ -60,7 +60,7 @@
       BOOST_PP_STRINGIZE(ENUM); \
   } \
                                                                             \
- inline friend \
+ inline \
   ENUM convert_to( \
     const std::string& str, \
     boost::dummy::type_tag<ENUM> const& \
@@ -71,7 +71,7 @@
     ); \
   } \
                                                                             \
- inline friend \
+ inline \
   const char* c_str(ENUM e) \
   { \
     switch (boost::enums::native_value(e)) \
@@ -88,22 +88,22 @@
   } \
 
 /**
-
+
  @brief Generates a @c boost::enums::meta::size specialization.
-
+
  @Remark This macro is presented here for exposition only reasons and is not part of the interface.
-
+
  @Params
  @Param{NS_EC, the @p NAMESPACES_CLASS sequence}
  @Param{EL, the @p ENUMERATOR_LIST sequence}
  
  @Result
  @code
- template <>
- struct size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
- {
- static const std::size_t value = BOOST_PP_SEQ_SIZE(EL);
- };
+ template <>
+ struct size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
+ {
+ static const std::size_t value = BOOST_PP_SEQ_SIZE(EL);
+ };
  @endcode
 
  */
@@ -112,9 +112,11 @@
   template <> \
   struct size<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)> \
   { \
- static const std::size_t value=BOOST_PP_SEQ_SIZE(EL); \
+ enum {value=BOOST_PP_SEQ_SIZE(EL)};\
   }; \
-
+// None of the fiollowing declaration works when we need the size as template parameter ?
+// BOOST_STATIC_CONSTANT(std::size_t, value=BOOST_PP_SEQ_SIZE(EL));
+// static const std::size_t value=BOOST_PP_SEQ_SIZE(EL);
 
 #define BOOST_ENUMS_ENUM_DCL_SIZE_SPE2(NS_EC, EL) \
   const std::size_t \
@@ -122,34 +124,34 @@
     BOOST_PP_SEQ_SIZE(EL);
 
 /**
-
+
  @brief Generates a @c boost::enums::meta::pos/val specialization.
-
+
  @Remark This macro is presented here for exposition only reasons and is not part of the interface.
-
+
  @Params
  @Param{P,NOT USED}
  @Param{QNAME,the @p NAMESPACES_CLASS qualified name}
  @Param{P,the position in the @c ENUMERATOR_LIST sequence}
  @Param{ED, the @c ENUMERATOR_DEFINITION sequence}
-
+
  @Result
  @code
- template <>
- struct pos<QNAME, QNAME :: BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED)>
- {
- BOOST_STATIC_CONSTEXPR std::size_t value = P;
- };
- template <>
- struct val<QNAME, P>
- {
- BOOST_STATIC_CONSTEXPR
- boost::enums::native_type<QNAME>::type value =
- QNAME::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED);
+ template <>
+ struct pos<QNAME, QNAME :: BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED)>
+ {
+ BOOST_STATIC_CONSTEXPR std::size_t value = P;
  };
-
+ template <>
+ struct val<QNAME, P>
+ {
+ BOOST_STATIC_CONSTEXPR
+ boost::enums::native_type<QNAME>::type value =
+ QNAME::BOOST_ENUMS_ENUMERATOR_DEFINITION_ID(ED);
+ };
+
  @endcode
-
+
  */
 
 #define BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE(R, QNAME, P, ED) \
@@ -167,23 +169,23 @@
   };
 
 /**
-
+
  @brief Generates the enum_trait specialization.
-
+
  @Remark This macro is presented here for exposition only reasons and is not part of the interface.
-
+
  @Params
  @Param{NS_EC, the @c NAMESPACES_CLASS sequence}
  @Param{TRAITER,the enum traiter template class}
  
  @Result
  @code
- template <>
- struct enum_traits<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
- : TRAITER<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
+ template <>
+ struct enum_traits<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
+ : TRAITER<BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC)>
  {};
  @endcode
-
+
  */
 
 #define BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(NS_EC, TRAITER) \
@@ -193,31 +195,31 @@
   {};
 
 /**
-
+
  @brief Generates all the needed specialization associated to an ordinal scoped enum.
-
+
  @Remark This macro is presented here for exposition only reasons and is not part of the interface.
-
+
  @Params
  @Param{NS_EC,the @c NAMESPACES_CLASS sequence}
  @Param{TRAITER,the enum traiter template class}
  @Result
  @code
- namespace boost {
- namespace enums {
- namespace meta {
- BOOST_ENUMS_ENUM_DCL_SIZE_SPE(NS_EC, EL)
- BOOST_PP_SEQ_FOR_EACH_I(
- BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE,
- BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC),
- EL
- )
- BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(NS_EC, TRAITER)
- }
- }
- }
+ namespace boost {
+ namespace enums {
+ namespace meta {
+ BOOST_ENUMS_ENUM_DCL_SIZE_SPE(NS_EC, EL)
+ BOOST_PP_SEQ_FOR_EACH_I(
+ BOOST_ENUMS_ENUM_DCL_POS_VAL_SPE,
+ BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC),
+ EL
+ )
+ BOOST_ENUMS_ENUM_DCL_TRAITS_SPE(NS_EC, TRAITER)
+ }
+ }
+ }
  @endcode
-
+
  */
 
 #define BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
@@ -236,131 +238,135 @@
   }
 
 /**
-
+
  @brief Generates all the needed definition associated to an ordinal scoped enum type with string conversions and constructors.
-
+
  @Params
  @Param{NS_EC, the @c NAMESPACES_CLASS sequence}
  @Param{UT,the underlying type}
  @Param{EL,the @c ENUMERATOR_LIST sequence}
  @Param{TRAITER,the enum traiter template class}
-
+
  @Result
  @code
- BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
- {
- BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
- }
- BOOST_ENUM_NS_TYPE_CONS_END(NS_EC, UT)
+ BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
+ {
+ BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
+ }
+ BOOST_ENUM_NS_TYPE_CONS_END(NS_EC, UT)
  BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
  @endcode
-
+
  */
 
 #define BOOST_ENUMS_ENUM_TYPE_DCL_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_TYPE_START(NS_EC, UT) \
   { \
     BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL) \
- }; \
- BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
- typedef BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC) this_type \
+ } \
   BOOST_ENUM_NS_TYPE_CONS_END(NS_EC, UT) \
- BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
+ BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
+ BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
+ BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
 
 /**
-
+
  @brief Generates all the needed definition associated to an ordinal scoped enum type with string conversions and without constructors.
-
+
  @Params
  @Param{NS_EC, the @c NAMESPACES_CLASS sequence}
  @Param{UT,the underlying type}
  @Param{EL,the @c ENUMERATOR_LIST sequence}
  @Param{TRAITER,the enum traiter template class}
-
+
  @Result
  @code
- BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
- {
+ BOOST_ENUM_NS_TYPE_START(NS_EC, UT)
+ {
    BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
- }
- BOOST_ENUM_NS_TYPE_NO_CONS_END(NS_EC, UT)
+ }
+ BOOST_ENUM_NS_TYPE_NO_CONS_END(NS_EC, UT)
  BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
  @endcode
-
+
  */
 #define BOOST_ENUMS_ENUM_TYPE_DCL_NO_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_TYPE_START(NS_EC, UT) \
   { \
     BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL) \
- }; \
- BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
- typedef BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC) this_type \
+ } \
   BOOST_ENUM_NS_TYPE_NO_CONS_END(NS_EC, UT) \
- BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
+ BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
+ BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
+ BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
 
 /**
-
+
  @brief Generates all the needed definition associated to an ordinal scoped enum class with string conversions and with constructors.
-
+
  @Params
  @Param{NS_EC, the @c NAMESPACES_CLASS sequence}
  @Param{UT,the underlying type}
  @Param{EL,the @c ENUMERATOR_LIST sequence}
  @Param{TRAITER,the enum traiter template class}
-
+
  @Result
  @code
- BOOST_ENUM_NS_CLASS_START(NS_EC, UT)
- {
+ BOOST_ENUM_NS_CLASS_START(NS_EC, UT)
+ {
    BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
- }
- BOOST_ENUM_NS_CLASS_CONS_END(NS_EC, UT)
+ }
+ BOOST_ENUM_NS_CLASS_CONS_END(NS_EC, UT)
  BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
  @endcode
-
+
  */
 
 #define BOOST_ENUMS_ENUM_CLASS_DCL_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_CLASS_START(NS_EC, UT) \
   { \
     BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL) \
- }; \
- BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
- typedef BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC) this_type \
+ } \
   BOOST_ENUM_NS_CLASS_CONS_END(NS_EC, UT) \
- BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
+ BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
+ BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
+ BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
 
 /**
-
+
  @brief Generates all the needed definition associated to an ordinal scoped enum class with string conversions and without constructors.
-
+
  @Params
  @Param{NS_EC, the @c NAMESPACES_CLASS sequence}
  @Param{UT,the underlying type}
  @Param{EL,the @c ENUMERATOR_LIST sequence}
  @Param{TRAITER,the enum traiter template class}
-
+
  @Result
  @code
- BOOST_ENUM_NS_CLASS_START(NS_EC, UT)
- {
+ BOOST_ENUM_NS_CLASS_START(NS_EC, UT)
+ {
    BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL)
- }
- BOOST_ENUM_NS_CLASS_NO_CONS_END(NS_EC, UT)
+ }
+ BOOST_ENUM_NS_CLASS_NO_CONS_END(NS_EC, UT)
  BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
  @endcode
-
+
  */
 
 #define BOOST_ENUMS_ENUM_CLASS_DCL_NO_CONS(NS_EC, UT, EL, TRAITER) \
   BOOST_ENUM_NS_CLASS_START(NS_EC, UT) \
   { \
     BOOST_ENUMS_ENUMERATOR_LIST_GENERATE(EL) \
- }; \
- BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
- typedef BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC) this_type \
+ } \
   BOOST_ENUM_NS_CLASS_NO_CONS_END(NS_EC, UT) \
- BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER)
+ BOOST_ENUMS_ENUM_DCL_SPE(NS_EC, EL, TRAITER) \
+ BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
+ BOOST_ENUMS_DCL_STRING_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), EL) \
+ BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
 
 
 

Modified: sandbox/enums/boost/enums/pp/namespaces.hpp
==============================================================================
--- sandbox/enums/boost/enums/pp/namespaces.hpp (original)
+++ sandbox/enums/boost/enums/pp/namespaces.hpp 2011-03-24 21:25:00 EDT (Thu, 24 Mar 2011)
@@ -11,51 +11,52 @@
 //////////////////////////////////////////////////////////////////////////////
 
 /** @file
-
-
+
+
  @brief @c NAMESPACES, @c NAMESPACES_CLASS PP data types and macros.
-
+
  @details
-
-
+
+
  A @c NAMESPACES is a variable sequence of namespace identifiers.
-
+
  @Example
  @code
  (NS1)(NS2)
  @endcode
 
  A @c NAMESPACES_CLASS is a variable sequence of namespace identifiers followed by a class identifier.
-
+
  @Example
  @code
  (NS1)(NS2)(ENUM)
  @endcode
-
+
  All the operations are prefixed by @c BOOST_ENUMS_NAMESAPCES_ or @c BOOST_ENUMS_NAMESAPCES_CLASS.
-
- */
+
+ */
 
 
 #ifndef BOOST_ENUMS_PP_NAMESPACES_HPP
 #define BOOST_ENUMS_PP_NAMESPACES_HPP
 
-#include <boost/preprocessor/if.hpp>
+#include <boost/preprocessor/control/iif.hpp>
 #include <boost/preprocessor/empty.hpp>
 #include <boost/preprocessor/seq.hpp>
 #include <boost/preprocessor/dec.hpp>
-//#include <boost/preprocessor.hpp>
+#include <boost/preprocessor/comparison/equal.hpp>
+#include <boost/preprocessor.hpp>
 
 
 /**
-
+
  @brief Get the @c NAMESPACES part of a @c NAMESPACES_CLASS.
-
+
  @Params
  @Param{SEQ,the @c NAMESPACES_CLASS}
-
+
  @Result the @c NAMESPACES part.
-
+
  */
 
 
@@ -63,14 +64,14 @@
   BOOST_PP_SEQ_POP_BACK(SEQ)
 
 /**
-
+
  @brief Get the CLASS part of a @c NAMESPACES_CLASS.
-
+
  @Params
  @Param{SEQ,the @c NAMESPACES_CLASS}
-
+
  @Result the @c CLASS part.
-
+
  */
 
 
@@ -78,12 +79,12 @@
   BOOST_PP_SEQ_ELEM(BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(SEQ)), SEQ)
 
 /**
-
+
  @brief Generate the opening of the namespaces in @c NAMESPACES.
-
+
  @Params
  @Param{SEQ,the @c NAMESPACES sequence}
-
+
  @Result
  @code
  namespace NS1 { ... namespace NSn {
@@ -99,12 +100,12 @@
   BOOST_PP_SEQ_FOR_EACH(BOOST_ENUMS_NAMESPACES_OPEN_, ~, SEQ)
 
 /**
-
+
  @brief Generate the closing of the namespaces in @c NAMESPACES.
-
+
  @Params
  @Param{SEQ,the @c NAMESPACES sequence}
-
+
  @Result
  @code
  } ... }
@@ -121,25 +122,44 @@
 // NS1::...NSn::
 
 #define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_(r, data, elem) elem ::
-#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE(SEQ) \
+#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_EMPTY(SEQ)
+#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_NON_EMPTY(SEQ) \
   BOOST_PP_SEQ_FOR_EACH(BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_, ~, SEQ)
 
+#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE(SEQ) \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(SEQ),0) \
+ , BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_EMPTY \
+ , BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE_NON_EMPTY \
+ )(SEQ)
+
 #endif
 
 /**
-
+
  @brief the qualified name associated to @c NAMESPACES_CLASS.
-
+
  @Params
  - SEQ: the @c NAMESPACES_CLASS sequence
-
+
  @Result
  @code
  NS1::...NSn::ENUM
  @endcode
  */
 
-#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME(SEQ) \
+#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_NS_C(SEQ) \
   BOOST_ENUMS_NAMESPACES_CLASS_QNAME_PRE(BOOST_ENUMS_NAMESPACES_CLASS_NS(SEQ)) BOOST_ENUMS_NAMESPACES_CLASS_ENUM(SEQ)
 
+#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME_C(SEQ) \
+ BOOST_ENUMS_NAMESPACES_CLASS_ENUM(SEQ)
+
+
+#define BOOST_ENUMS_NAMESPACES_CLASS_QNAME(SEQ) \
+ BOOST_PP_IIF( \
+ BOOST_PP_EQUAL(BOOST_PP_SEQ_SIZE(SEQ),1) \
+ , BOOST_ENUMS_NAMESPACES_CLASS_QNAME_C \
+ , BOOST_ENUMS_NAMESPACES_CLASS_QNAME_NS_C \
+ )(SEQ)
+
 #endif // BOOST_ENUMS_PP_NAMESPACES_HPP

Modified: sandbox/enums/boost/enums/scoped/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/emulation.hpp (original)
+++ sandbox/enums/boost/enums/scoped/emulation.hpp 2011-03-24 21:25:00 EDT (Thu, 24 Mar 2011)
@@ -13,6 +13,8 @@
 #ifndef BOOST_ENUMS_SCOPED_EMULATION_HPP
 #define BOOST_ENUMS_SCOPED_EMULATION_HPP
 
+#include <boost/enums/config.hpp>
+
 #include <boost/enums/scoped/underlying_type.hpp>
 #include <boost/enums/scoped/native_type.hpp>
 #include <boost/enums/scoped/scoping_type.hpp>
@@ -21,8 +23,8 @@
 #include <boost/enums/scoped/underlying_value.hpp>
 #include <boost/enums/scoped/is_enum.hpp>
 #include <boost/conversion/convert_to.hpp>
-#include <boost/enums/config.hpp>
 #include <boost/enums/pp/namespaces.hpp>
+#include <cstring>
 
 #ifndef BOOST_ENUMS_DOXYGEN_INVOKED
 
@@ -93,7 +95,7 @@
   #ifdef BOOST_NO_UNDERLYING_TYPE
 
     #define BOOST_ENUMS_DETAIL_UNDERLYING_TYPE_SPEC(EC, UT) \
- namespace boost { \
+ namespace boost { \
         namespace enums { \
           namespace meta { \
             template <> \
@@ -153,25 +155,25 @@
 
 
 #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
- inline friend EC convert_to(UT v \
+ inline EC convert_to(UT v \
     , boost::dummy::type_tag<EC> const& \
   ) \
   { \
     return EC::convert_to(v); \
   } \
- inline friend EC convert_to(boost::enums::native_type<EC>::type v \
+ inline EC convert_to(boost::enums::native_type<EC>::type v \
     , boost::dummy::type_tag<EC> const& \
   ) \
   { \
     return EC::convert_to(v); \
   } \
- inline friend UT convert_to(EC v \
+ inline UT convert_to(EC v \
     , boost::dummy::type_tag<UT> const& \
   ) \
   { \
     return boost::enums::underlying_value(v); \
   } \
- inline friend boost::enums::native_type<EC>::type convert_to(EC v \
+ inline boost::enums::native_type<EC>::type convert_to(EC v \
     , boost::dummy::type_tag<boost::enums::native_type<EC>::type> const& \
   ) \
   { \
@@ -209,8 +211,10 @@
   underlying_type underlying_value() const \
   { \
     return val_; \
- } \
- BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT)
+ }
+
+
+ //BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT)
 
 
 #endif
@@ -226,37 +230,37 @@
 
   #define BOOST_ENUM_CLASS_END(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_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_FRIEND_CONVERSIONS(EC, UT) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
 
   #define BOOST_ENUM_TYPE_CONS_END(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)
 
+ #define BOOST_ENUMS_OUT(NS_EC, UT) \
+ BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT) \
+ BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
+ BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
+
 #else // BOOST_NO_SCOPED_ENUMS
 
   #define BOOST_ENUM_CLASS_START(EC, UT) \
@@ -276,20 +280,20 @@
     BOOST_ENUMS_DETAIL_END_1(EC, UT) \
     BOOST_ENUMS_DETAIL_END_2(EC, UT) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(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) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT) \
- };
+ };
 
   #define BOOST_ENUM_TYPE_NO_CONS_END(EC, UT) \
     BOOST_ENUMS_DETAIL_END_1(EC, UT) \
@@ -302,19 +306,26 @@
     BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT) \
     BOOST_ENUMS_DETAIL_END_2(EC, UT) \
     BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(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_SCOPING_TYPE_SPEC(EC) \
     BOOST_ENUMS_DETAIL_IS_ENUM_TYPE_SPEC(EC)
 
+ #define BOOST_ENUMS_OUT(NS_EC, UT) \
+ BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT) \
+ BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
+ BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
+ BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC))
+
+#endif
 #define BOOST_ENUM_NS_CLASS_START(NS_EC, UT) \
   BOOST_ENUMS_NAMESPACES_OPEN(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
   BOOST_ENUM_CLASS_START(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT)
@@ -326,34 +337,32 @@
 #define BOOST_ENUM_NS_CLASS_END(NS_EC, UT) \
   BOOST_ENUM_CLASS_END(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
   BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
- BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+ BOOST_ENUMS_OUT(NS_EC, UT)
 
 
 #define BOOST_ENUM_NS_TYPE_END(NS_EC, UT) \
   BOOST_ENUM_TYPE_END(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
   BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
- BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+ BOOST_ENUMS_OUT(NS_EC, UT)
 
 #define BOOST_ENUM_NS_CLASS_NO_CONS_END(NS_EC, UT) \
   BOOST_ENUM_CLASS_NO_CONS_END(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
   BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
- BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+ BOOST_ENUMS_OUT(NS_EC, UT)
 
 #define BOOST_ENUM_NS_TYPE_NO_CONS_END(NS_EC, UT) \
   BOOST_ENUM_TYPE_NO_CONS_END(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
   BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
- BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+ BOOST_ENUMS_OUT(NS_EC, UT)
 
 #define BOOST_ENUM_NS_CLASS_CONS_END(NS_EC, UT) \
   BOOST_ENUM_CLASS_CONS_END(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
   BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
- BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
+ BOOST_ENUMS_OUT(NS_EC, UT)
 
 #define BOOST_ENUM_NS_TYPE_CONS_END(NS_EC, UT) \
   BOOST_ENUM_TYPE_CONS_END(BOOST_ENUMS_NAMESPACES_CLASS_ENUM(NS_EC), UT) \
   BOOST_ENUMS_NAMESPACES_CLOSE(BOOST_ENUMS_NAMESPACES_CLASS_NS(NS_EC)) \
- BOOST_ENUMS_SPECIALIZATIONS(BOOST_ENUMS_NAMESPACES_CLASS_QNAME(NS_EC), UT)
-
+ BOOST_ENUMS_OUT(NS_EC, UT)
 
 #endif // BOOST_ENUMS_SCOPED_EMULATION_HPP
-#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