Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69500 - sandbox/enums/boost/enums
From: vicente.botet_at_[hidden]
Date: 2011-03-02 19:19:34


Author: viboes
Date: 2011-03-02 19:19:32 EST (Wed, 02 Mar 2011)
New Revision: 69500
URL: http://svn.boost.org/trac/boost/changeset/69500

Log:
Enums: Add provisional enum_set constructors from c-str and std::string
Text files modified:
   sandbox/enums/boost/enums/enum_set.hpp | 31 +++++++++++++++++++++++++++----
   1 files changed, 27 insertions(+), 4 deletions(-)

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-02 19:19:32 EST (Wed, 02 Mar 2011)
@@ -17,7 +17,11 @@
 
 #include <boost/enums/enum_traits.hpp>
 #include <bitset>
-#include <iostream>
+#include <stdexcept>
+#include <iosfwd>
+#include <string>
+#include <cstddef>
+#include <climits>
 #include <boost/functional/hash.hpp>
 
 #include <boost/config.hpp>
@@ -34,14 +38,33 @@
       BOOST_CONSTEXPR enum_set()
       {
       }
- BOOST_CONSTEXPR enum_set(enum_type setting)
+ BOOST_CONSTEXPR explicit enum_set(enum_type setting)
       {
         set(setting);
       }
- BOOST_CONSTEXPR enum_set(unsigned long long val)
- : bits(val)
+ BOOST_CONSTEXPR explicit enum_set(unsigned long long val)
+ : bits(val)
       {
       }
+ //#if defined(__GNUC__) && (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 ))
+ #if 1
+ #else
+ 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,
+ typename std::basic_string<charT,ch_traits,TAllocator>::size_type n =
+ std::basic_string<charT,ch_traits,TAllocator>::npos,
+ charT zero = charT('0'), charT one = charT('1'))
+ : bits(str, pos, n, zero, one)
+ {}
+ template <class charT>
+ explicit enum_set(const charT* str,
+ typename std::basic_string<charT>::size_type n = std::basic_string<charT>::npos,
+ charT zero = charT('0'), charT one = charT('1'))
+ : bits(str,n, zero, one)
+ {}
+ #endif
+
       enum_set &operator&=(const enum_set &rhs)
       {
         bits &= rhs.bits;


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