Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69493 - sandbox/enums/boost/enums
From: vicente.botet_at_[hidden]
Date: 2011-03-02 17:32:13


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

Log:
Enums: Fix error on enum_set construction from long long + formatting
Text files modified:
   sandbox/enums/boost/enums/enum_array.hpp | 61 +++++++++++++++++++++++++++------------
   sandbox/enums/boost/enums/enum_set.hpp | 1
   2 files changed, 43 insertions(+), 19 deletions(-)

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-02 17:32:13 EST (Wed, 02 Mar 2011)
@@ -95,7 +95,9 @@
         typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
 #endif
 
- reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rbegin() {
+ return reverse_iterator(end());
+ }
         const_reverse_iterator rbegin() const {
             return const_reverse_iterator(end());
         }
@@ -103,7 +105,9 @@
             return const_reverse_iterator(end());
         }
 
- reverse_iterator rend() { return reverse_iterator(begin()); }
+ reverse_iterator rend() {
+ return reverse_iterator(begin());
+ }
         const_reverse_iterator rend() const {
             return const_reverse_iterator(begin());
         }
@@ -175,17 +179,24 @@
         enum { static_size = N };
 
         // swap (note: linear complexity)
- void swap (enum_array<T,EC>& y) {
+ void swap (enum_array<T,EC>& y)
+ {
             for (size_type i = 0; i < N; ++i)
                 boost::swap(elems[i],y.elems[i]);
         }
 
         // direct access to data (read-only)
- const T* data() const { return elems; }
- T* data() { return elems; }
+ const T* data() const {
+ return elems;
+ }
+ T* data() {
+ return elems;
+ }
 
         // use enum_array as C array (direct read/write access to data)
- T* c_array() { return elems; }
+ T* c_array() {
+ return elems;
+ }
 
         // assignment with type conversion
         template <typename T2>
@@ -194,8 +205,11 @@
             return *this;
         }
 
+ // A synonym for fill
         // assign one value to all elements
- void assign (const T& value) { fill ( value ); } // A synonym for fill
+ void assign (const T& value) {
+ fill ( value );
+ }
         void fill (const T& value)
         {
             std::fill_n(begin(),size(),value);
@@ -203,12 +217,12 @@
 
         // check range (may be private because it is static)
         static size_type rangecheck (key_type k) {
- size_type i = rangecheck(k);
+ size_type i = enum_traits<key_type>::pos(k);
             if (i >= N) {
                 std::out_of_range e("array<>: index out of range");
                 boost::throw_exception(e);
             }
- return i;
+ return i;
         }
 
     };
@@ -217,33 +231,40 @@
 
     // comparisons
     template<class T, typename EC>
- bool operator== (const enum_array<T,EC>& x, const enum_array<T,EC>& y) {
+ bool operator== (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
+ {
         return 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) {
+ 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());
     }
     template<class T, typename EC>
- bool operator!= (const enum_array<T,EC>& x, const enum_array<T,EC>& y) {
+ bool operator!= (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
+ {
         return !(x==y);
     }
     template<class T, typename EC>
- bool operator> (const enum_array<T,EC>& x, const enum_array<T,EC>& y) {
+ bool operator> (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
+ {
         return y<x;
     }
     template<class T, typename EC>
- bool operator<= (const enum_array<T,EC>& x, const enum_array<T,EC>& y) {
+ bool operator<= (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
+ {
         return !(y<x);
     }
     template<class T, typename EC>
- bool operator>= (const enum_array<T,EC>& x, const enum_array<T,EC>& y) {
+ bool operator>= (const enum_array<T,EC>& x, const enum_array<T,EC>& y)
+ {
         return !(x<y);
     }
 
     // global swap()
     template<class T, typename EC>
- inline void swap (enum_array<T,EC>& x, enum_array<T,EC>& y) {
+ inline void swap (enum_array<T,EC>& x, enum_array<T,EC>& y)
+ {
         x.swap(y);
     }
 
@@ -293,11 +314,13 @@
     
     template <class T, typename EC>
     class tuple_size<enum_array<T, EC> >
- : public integral_constant<size_t, meta::size<EC>::value> {};
+ : public integral_constant<size_t, meta::size<EC>::value>
+ {};
 
     template <class T, typename EC>
     class tuple_size<const enum_array<T, EC> >
- : public integral_constant<size_t, meta::size<EC>::value> {};
+ : public integral_constant<size_t, meta::size<EC>::value>
+ {};
 
     template <class T, typename EC, enum_type<EC>::type K>
     class tuple_element<enum_array<T, EC> >
@@ -314,7 +337,7 @@
     };
 
     template <class T, typename EC, enum_type<EC>::type K>
- inline
+ inline
     T&
     get(enum_array<T, EC>& a)
     {

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 17:32:13 EST (Wed, 02 Mar 2011)
@@ -39,6 +39,7 @@
         set(setting);
       }
       BOOST_CONSTEXPR enum_set(unsigned long long val)
+ : bits(val)
       {
       }
       enum_set &operator&=(const enum_set &rhs)


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