|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r69951 - in sandbox/enums/boost/enums: . mpl
From: vicente.botet_at_[hidden]
Date: 2011-03-13 11:34:16
Author: viboes
Date: 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
New Revision: 69951
URL: http://svn.boost.org/trac/boost/changeset/69951
Log:
Enums: updated doxygen doc
Text files modified:
sandbox/enums/boost/enums/default_value.hpp | 4
sandbox/enums/boost/enums/emulation.hpp | 196 +++++++++++++++-------------
sandbox/enums/boost/enums/emulator_type.hpp | 13 +
sandbox/enums/boost/enums/enum_array.hpp | 157 ++++++++++++----------
sandbox/enums/boost/enums/enum_range.hpp | 32 +++
sandbox/enums/boost/enums/enum_set.hpp | 272 +++++++++++++++++++++------------------
sandbox/enums/boost/enums/enum_traiter.hpp | 28 +++
sandbox/enums/boost/enums/enum_traits.hpp | 34 +++-
sandbox/enums/boost/enums/first.hpp | 1
sandbox/enums/boost/enums/last.hpp | 7 +
sandbox/enums/boost/enums/mpl/enum_c_tag.hpp | 12 +
sandbox/enums/boost/enums/mpl/equal_to.hpp | 21 +-
sandbox/enums/boost/enums/mpl/greater.hpp | 21 +-
sandbox/enums/boost/enums/mpl/greater_equal.hpp | 22 +-
sandbox/enums/boost/enums/mpl/less.hpp | 22 +-
sandbox/enums/boost/enums/mpl/less_equal.hpp | 20 +-
sandbox/enums/boost/enums/mpl/numeric_cast.hpp | 19 +-
sandbox/enums/boost/enums/pos.hpp | 33 +++
sandbox/enums/boost/enums/pred.hpp | 7 +
sandbox/enums/boost/enums/size.hpp | 21 ++
sandbox/enums/boost/enums/succ.hpp | 15 +
sandbox/enums/boost/enums/underlying_type.hpp | 16 +
sandbox/enums/boost/enums/val.hpp | 27 +++
23 files changed, 611 insertions(+), 389 deletions(-)
Modified: sandbox/enums/boost/enums/default_value.hpp
==============================================================================
--- sandbox/enums/boost/enums/default_value.hpp (original)
+++ sandbox/enums/boost/enums/default_value.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -18,7 +18,9 @@
namespace boost {
namespace enums {
- //! build a enum class with the default value
+ //! builds a enum class with the default value.
+
+ //! \return the default value
template <typename EC>
inline EC default_value()
{
Modified: sandbox/enums/boost/enums/emulation.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulation.hpp (original)
+++ sandbox/enums/boost/enums/emulation.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -23,6 +23,8 @@
#include <boost/preprocessor/empty.hpp>
#include <boost/enums/config.hpp>
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
+
#ifndef BOOST_NO_SCOPED_ENUMS
#define BOOST_ENUMS_DETAIL_BINARY_OPERATOR(EC, UT, OP) \
inline BOOST_CONSTEXPR bool operator OP(EC lhs, EC rhs) { \
@@ -48,11 +50,11 @@
#if !defined(BOOST_NO_SCOPED_ENUMS) && ! defined(BOOST_NO_SCOPED_ENUMS_COMPARE)
-#define BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
+ #define BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT)
#else // !defined(BOOST_NO_SCOPED_ENUMS) && ! defined(BOOST_NO_SCOPED_ENUMS_COMPARE)
-#define BOOST_ENUMS_DETAIL_COMPARAISON_OPERATORS(EC, UT) \
+ #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, <) \
@@ -114,6 +116,105 @@
{ \
return static_cast<UT>(boost::enums::get_value(v) ); \
}
+#else
+
+#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() \
+ BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)
+
+#define BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
+ operator UT() { return val_; }
+
+#define BOOST_ENUMS_DETAIL_CONVERSIONS_AUX() \
+ BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT)
+
+#define BOOST_ENUM_CLASS_START(EC, UT) \
+ class EC \
+ { \
+ public: \
+ enum type
+
+#define BOOST_ENUM_TYPE_START(EC, UT) \
+ class EC \
+ { \
+ public: \
+ enum type
+
+#define BOOST_ENUMS_DETAIL_END_1(EC, UT) \
+ ; \
+ typedef UT underlying_type; \
+ private: \
+ underlying_type val_; \
+ public:
+
+
+
+#define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
+ inline EC convert_to(UT 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 UT convert_to(EC v \
+ , boost::dummy::type_tag<UT> const& \
+ ) \
+ { \
+ 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); \
+ }
+
+
+#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)
+
+
+#endif
+#endif
+
+#ifndef BOOST_NO_SCOPED_ENUMS
#define BOOST_ENUM_CLASS_START(EC, UT) \
enum class EC : UT
@@ -157,97 +258,6 @@
#else // BOOST_NO_SCOPED_ENUMS
- #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() \
- BOOST_ENUMS_DETAIL_CONSTRUCTORS(EC, UT)
-
- #define BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT) \
- operator UT() { return val_; }
-
- #define BOOST_ENUMS_DETAIL_CONVERSIONS_AUX() \
- BOOST_ENUMS_DETAIL_CONVERSIONS(EC, UT)
-
- #define BOOST_ENUM_CLASS_START(EC, UT) \
- class EC \
- { \
- public: \
- enum type
-
- #define BOOST_ENUM_TYPE_START(EC, UT) \
- class EC \
- { \
- public: \
- enum type
-
- #define BOOST_ENUMS_DETAIL_END_1(EC, UT) \
- ; \
- typedef UT underlying_type; \
- private: \
- underlying_type val_; \
- public:
-
-
-
- #define BOOST_ENUMS_DETAIL_FRIEND_CONVERSIONS(EC, UT) \
- inline EC convert_to(UT 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 UT convert_to(EC v \
- , boost::dummy::type_tag<UT> const& \
- ) \
- { \
- 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); \
- }
-
-
- #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) \
Modified: sandbox/enums/boost/enums/emulator_type.hpp
==============================================================================
--- sandbox/enums/boost/enums/emulator_type.hpp (original)
+++ sandbox/enums/boost/enums/emulator_type.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,12 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/emulator!type.hpp> defines the declaration of emulator_type<> meta-function.
+ */
+
#ifndef BOOST_ENUMS_EMULATOR_TYPE_HPP
#define BOOST_ENUMS_EMULATOR_TYPE_HPP
@@ -19,9 +25,10 @@
{
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.
+ /*! 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;
}
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-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -13,9 +13,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.
+\file
+\brief
+The header \c <boost/enums/enum_array.hpp> defines a class template for storing
+sequences of objects fixed by the size of the enumeration.
+We can say that
+\c enum_array is the counterpart of \c std::array when the index are enums.
*/
#ifndef BOOST_ENUMS_ENUM_ARRAY_HPP
@@ -53,33 +56,46 @@
{
/*!
- 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.
+ An \c enum_array supports random access iterators. An instance of \c enum_array<T, EC>
+ stores as many elements of type \c T as enum literals are on the enum class \c EC,
+ so that <tt>size() == meta::size<EC>::value</tt> is an invariant.
+
+ The elements of an \c enum_array are stored contiguously, meaning that if \c a is an
+ \c enum_array<T, EC>, then it obeys the identity
+
+ \code
+ &a[n] == &a[0] + n for all 0 <= n < meta::size<EC>::value.
+ \endcode
+
+ An \c enum_array is an aggregate that can (????) be initialized with the syntax
+
+ \code
+ enum_array<T, EC> a = { initializer-list };
+ \endcode
- The elements of an enum_array are stored contiguously, meaning that if a is an
- enum_array<T, EC>, then it obeys the identity
+ where \e initializer-list is a comma separated list of up to \c meta::size<EC>::value
+ elements whose types are convertible to \c T.
- &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
+ An \c 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
+ empty and that swap does not have constant complexity. An \c 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.
+
+ The conditions for an aggregate are met. Class enum_array relies on
+ the implicitly-declared special member functions to conform to the
+ container requirements
+
+
- Note: The member variable elems is shown for exposition only, to emphasize
+ \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_arrays interface
- */
+ enum_array's interface
+
+ \param T array's element type
+ \param EC array's index enumeration class
+ */
template<class T, typename EC>
class enum_array {
@@ -100,29 +116,24 @@
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
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
- */
-
+ //enum_array() {}
+
// iterator support
- //! Returns: iterator for the first element
- //! Throws: will not throw
+ //! \returns iterator for the first element
+ //! \throws Nothing
iterator begin() { return elems; }
- //! Returns: const iterator for the first element
- //! Throws: will not throw
+ //! \returns const iterator for the first element
+ //! \throws Nothing
const_iterator begin() const { return elems; }
const_iterator cbegin() const { return elems; }
- //! Returns: iterator for position after the last element
- //! Throws: will not throw
+ //! \returns iterator for position after the last element
+ //! \throws Nothing
iterator end() { return elems+static_size; }
- //! Returns: const iterator for position after the last element
- //! Throws: will not throw
+ //! \returns const iterator for position after the last element
+ //! \throws Nothing
const_iterator end() const { return elems+static_size; }
const_iterator cend() const { return elems+static_size; }
@@ -147,7 +158,7 @@
typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
#endif
- //! Returns: reverse iterator for the first element of reverse iteration
+ //! \returns reverse iterator for the first element of reverse iteration
reverse_iterator rbegin() {
return reverse_iterator(end());
}
@@ -158,7 +169,7 @@
return const_reverse_iterator(end());
}
- //! Returns: reverse iterator for position after the last element in reverse iteration
+ //! \returns reverse iterator for position after the last element in reverse iteration
reverse_iterator rend() {
return reverse_iterator(begin());
}
@@ -171,8 +182,8 @@
// operator[]
//! Requires: k'pos < static_size
- //! Returns: reference to the element with key k
- //! Throws: will not throw.
+ //! \returns reference to the element with key k
+ //! \throws Nothing.
reference operator[](key_type k)
{
size_type i = pos(k);
@@ -181,8 +192,8 @@
}
//! Requires: k'pos < static_size
- //! Returns: constant reference to the element with key k
- //! Throws: will not throw.
+ //! \returns constant reference to the element with key k
+ //! \throws Nothing.
const_reference operator[](key_type k) const
{
size_type i = pos(k);
@@ -191,8 +202,8 @@
}
// at() with range check
- //! Returns: element with key k
- //! Throws: std::range_error if i >= static_size
+ //! \returns element with key k
+ //! \throws std::range_error if i >= static_size
reference at(key_type k)
{
size_type i = rangecheck(k);
@@ -205,47 +216,48 @@
}
// front() and back()
- //! Returns: reference to the first element
- //! Throws: will not throw
+ //! \returns reference to the first element
+ //! \throws Nothing
reference front()
{
return elems[0];
}
- //! Returns: const reference to the first element
- //! Throws: will not throw
+ //! \returns const reference to the first element
+ //! \throws Nothing
const_reference front() const
{
return elems[0];
}
- //! Returns: reference to the last element
- //! Throws: will not throw
+ //! \returns reference to the last element
+ //! \throws Nothing
reference back()
{
return elems[static_size-1];
}
- //! Returns: const reference to the last element
- //! Throws: will not throw
+ //! \returns const reference to the last element
+ //! \throws Nothing
const_reference back() const
{
return elems[static_size-1];
}
// size is constant
+ //! \returns linear in meta::size<EC>::value.
BOOST_CONSTEXPR size_type size()
{
return static_size;
}
- //! Returns: false
- //! Throws: will not throw
+ //! \returns false
+ //! \throws Nothing
static bool empty()
{
return false;
}
- //! Returns: linear in meta::size<EC>::value.
+ //! \returns linear in meta::size<EC>::value.
BOOST_CONSTEXPR size_type max_size()
{
return static_size;
@@ -253,7 +265,7 @@
/*! Effects: swap_ranges(begin(), end(), y.begin())
- Throws: Nothing unless one of the element-wise swap calls throws an exception.
+ \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.
@@ -266,11 +278,11 @@
// direct access to data (read-only)
- //! Returns: elems.
+ //! \returns elems.
const T* data() const {
return elems;
}
- //! Returns: elems.
+ //! \returns elems.
T* data() {
return elems;
}
@@ -315,50 +327,53 @@
// comparisons
- //! Returns: std::equal(x.begin(), x.end(), y.begin())
+ //! \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())
+ //! \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)
+ //! \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
+ //! \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)
+ //! \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)
+ //! \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);
}
- // global swap()
- //! Effects:
- //! x.swap(y);
- //! Complexity: linear in meta::size<EC>::value.
+ //! enum_array's swap
+
+ //! <b>Effects:</b> As
+ //! \code
+ //! x.swap(y);
+ //! \endcode
+ //! <b>Complexity:</b> linear in \c meta::size<EC>::value.
template<class T, typename EC>
inline void swap (enum_array<T,EC>& x, enum_array<T,EC>& y)
@@ -393,17 +408,17 @@
return arg.elems;
}
#else
-// Specific for boost::enums::enum_array: simply returns its elems data member.
template <typename T, typename EC>
T(&get_c_array(enum_array<T,EC>& arg))[meta::size<EC>::value]
{
+ //! c_array conversion.
return arg.elems;
}
- // Const version.
template <typename T, typename EC>
const T(&get_c_array(const enum_array<T,EC>& arg))[meta::size<EC>::value]
{
+ //! c_array const conversion.
return arg.elems;
}
#endif
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-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,12 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_range.hpp> defines a class template \c enum_range for viewing an enumerations as a range.
+ */
+
#ifndef BOOST_ENUMS_ENUM_RANGE_HPP
#define BOOST_ENUMS_ENUM_RANGE_HPP
@@ -25,6 +31,7 @@
namespace boost {
namespace enums {
+ #ifndef BOOST_ENUMS_DOXYGEN_INVOKED
namespace enums_detail {
// enum_iterator is an iterator over an enum that
// is bounded only by the limits of the enum.
@@ -98,7 +105,10 @@
int index_;
};
} // namespace enums_detail
-
+ #endif
+ //! \c enum_range is a model of the \e RandomAccessRange Concept associated to the enumeration \c EC.
+
+
template<typename EC/* , typename Traits=enum_range_traits<EC> */ >
class enum_range
: public iterator_range< enums_detail::enum_iterator<EC/*, Traits*/> >
@@ -106,10 +116,13 @@
typedef enums_detail::enum_iterator<EC/*, Traits*/> iterator_t;
typedef iterator_range<iterator_t> base_t;
public:
+ //! builds a enum range
enum_range()
: base_t(iterator_t(0), iterator_t(enums::meta::size<EC>::value))
{
}
+
+ //! builds a enum sub-range
enum_range(EC first, EC last)
: base_t(iterator_t(enums::pos(first)),
iterator_t(enums::pos(last)+1))
@@ -117,12 +130,11 @@
}
};
- //! function to generate an enum Range.
+ //! 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.
+ //! \c make_range allows treating enums as a model of the \e RandomAccessRange Concept.
+
+ //! \pre \c EC is a model of the \e Enumeration Concept.
template<typename EC /*, typename Traits*/ >
enum_range<EC>
@@ -130,6 +142,14 @@
{
return enum_range<EC/*,Traits*/>();
}
+
+ //! function to generate an enum sub-range.
+
+ //! \c make_range allows treating enums as a model of the \e RandomAccessRange Concept.
+ //! It should be noted that the first and last parameters denoted a closed range.
+ //! \pre \c EC is a model of the \e Enumeration Concept.
+ //! \param first first element of the range
+ //! \param last last element of the range
template<typename EC /*, typename Traits */ >
enum_range<EC>
make_range(EC first, EC last)
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-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -12,6 +12,14 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_set.hpp> defines a class template \c enum_set<EC> for managing sets of enumeration and several
+ //! related functions for representing and manipulating sets of enums. We can say that
+ \c enum_set is the counterpart of \c std::bitset when the index are enums.
+ */
+
#ifndef BOOST_ENUMS_ENUM_SET_HPP
#define BOOST_ENUMS_ENUM_SET_HPP
@@ -25,14 +33,11 @@
#include <string>
#include <cstddef>
#include <climits>
+#include <string>
#include <boost/functional/hash.hpp>
#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 {
@@ -41,7 +46,9 @@
class enum_set
{
public:
- //! Effects: Constructs an object of class enum_set<>, initializing all
+ struct reference {
+ };
+ //! <b> Effects:</b> Constructs an object of class \c enum_set<>, initializing all
//! enumerations to zero.
BOOST_CONSTEXPR enum_set()
{
@@ -54,10 +61,10 @@
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
+ //! <b> Effects:</b> Constructs an object of class \c enum_set<>, initializing the
+ //! first \c M bit positions to the corresponding bit values in \c val.
+ //! \c M is the smaller of \c N and the number of bits in the value
+ //! representation of \c unsigned \c long \c long. If \c M<N, the remaining bit
//! positions are initialized to zero.
BOOST_CONSTEXPR explicit enum_set(unsigned long long val)
: bits(val)
@@ -67,23 +74,23 @@
#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.
+ //! \pre <tt>pos <= str.size()</tt>.
+ //! \throws out_of_range if <tt>pos > str.size()</tt>.
+ //! <b> Effects:</b> Determines the effective length \c rlen of the initializing
+ //! string as the smaller of \c n and <tt>str.size()-pos</tt>.
+ //! The function then throws \c invalid_argument if any of the \c rlen
+ //! characters in \c str beginning at position pos is other than zero or one.
+ //! The function uses \c ch_traits::eq() to compare the character values.
+ //! Otherwise, the function constructs an object of class \c enum_set<EC>,
+ //! initializing the first \c M bit positions to values determined from the
+ //! corresponding characters in the string \c str. \c M is the smaller of \c N and
+ //! \c rlen.\n
//! 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
+ //! corresponding character in \c str, beginning at position \c pos, is \c 0 zero.
+ //! Otherwise, the element has the value 1. Character position \c 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.
+ //! If \c 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,
@@ -93,7 +100,7 @@
: bits(str, pos, n, zero, one)
{}
- //! Effects: Constructs an object of class enumset<N> as if by enumset(string(str)).
+ //! <b> Effects:</b> Constructs an object of class enum_set<N> as if by enum_set(string(str)).
template <class charT>
explicit enum_set(const charT* str,
typename std::basic_string<charT>::size_type n = std::basic_string<charT>::npos,
@@ -102,47 +109,47 @@
{}
#endif
- //! Effects: Clears each bit in *this for which the corresponding bit in
- //! rhs is clear, and leaves all other bits unchanged.
- //! Returns: *this.
+ //! <b> Effects:</b> Clears each bit in \c *this for which the corresponding bit in
+ //! \c rhs is clear, and leaves all other bits unchanged.
+ //! \returns \c *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.
+ //! <b> Effects:</b> Sets each bit in \c *this for which the corresponding bit in
+ //! \c rhs is set, and leaves all other bits unchanged.
+ //! \returns \c *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.
+ //! <b> Effects:</b> Toggles each bit in \c *this for which the corresponding bit in
+ //! \c rhs is set, and leaves all other bits unchanged.
+ //! \returns \c *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.
+ //! <b> Effects:</b> Replaces each bit at position \c I in \c *this with a value determined as follows:
+ //! - If \c I<pos, the new value is zero;
+ //! - If \c I>=pos, the new value is the previous value of the bit at position \c I-pos.
+ //! \returns \c *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.
+ //! <b> Effects:</b> Replaces each bit at position \c I in \c *this with a value determined as follows:
+ //! - If \c pos>=N-I, the new value is zero;
+ //! - If \c pos<N-I, the new value is the previous value of the bit at position \c I+pos.
+ //! \returns \c *this.
enum_set &operator>>=(const enum_set &rhs)
{
@@ -150,39 +157,39 @@
return *this;
}
- //! Returns: A count of the number of bits set in *this.
+ //! \returns A count of the number of bits set in \c *this.
std::size_t count() const
{
return bits.count();
}
- //! Returns: N.
+ //! \returns \c static_size.
BOOST_CONSTEXPR std::size_t size() const
{
return bits.size();
}
- //! Requires: pos shall be valid.
- //! Throws: nothing.
- //! Returns: true if the bit at position pos in *this has the value one,
- //! otherwise false.
+ //! \pre \c pos shall be valid.
+ //! \throws nothing.
+ //! \returns \c true if the bit at position \c pos in \c *this has the value one,
+ //! otherwise \c 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,
+ //! \pre \c pos shall be valid.
+ //! \throws nothing.
+ //! \returns An object of type \c enum_set<EC>::reference such that
+ //! <tt>(*this)[pos] == this->test(pos)</tt>, and such that <tt>(*this)[pos] = val</tt> is
+ //! equivalent to <tt>this->set(pos, val)</tt>.
+ //! \note 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];
+ reference operator[](std::size_t pos); // for b[i];
- //! Effects: Sets all bits in *this.
- //! Returns: *this.
+ //! <b> Effects:</b> Sets all bits in \c *this.
+ //! \returns \c *this.
enum_set &set()
{
@@ -190,29 +197,29 @@
return *this;
}
- //! 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.
+ //! \pre \c setting is valid
+ //! \throws out_of_range if \c pos does not correspond to a valid bit position.
+ //! <b> Effects:</b> Stores a new value in the bit at the position associated to \c setting in \c *this.
+ //! If \c value is nonzero, the stored value is one, otherwise it is zero.
+ //! \returns \c *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.
+ //! <b> Effects:</b> Resets all bits in \c *this.
+ //! \returns \c *this.
enum_set &reset()
{
bits.reset();
return *this;
}
- //! 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.
+ //! \pre \c resetting is valid
+ //! \throws out_of_range if \c resetting does not correspond to a valid enum.
+ //! <b> Effects:</b> Resets the bit at the position associated to \c resetting in \c *this.
+ //! \returns \c *this.
enum_set &reset(EC resetting)
{
@@ -220,87 +227,89 @@
return *this;
}
- //! Effects: Toggles all bits in *this.
- //! Returns: *this.
+ //! <b> Effects:</b> Toggles all bits in \c *this.
+ //! \returns \c *this.
enum_set &flip()
{
bits.flip();
return *this;
}
- //! 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.
+ //! \pre \c flipping is valid
+ //! \throws out_of_range if \c flipping does not correspond to a valid enum.
+ //! <b> Effects:</b> Toggles the bit at position associated to \c pos in \c *this.
+ //! \returns \c *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.
+ //! \c <tt>unsigned long</tt> conversion
+ //! \throws overflow_error if the integral value \c x corresponding to the
+ //! bits in \c *this cannot be represented as type <<tt>unsigned long</tt>.
+ //! \returns \c 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.
-
+ //! \c <tt>unsigned long long</tt> conversion
+ //! \throws overflow_error if the integral value \c x corresponding to the
+ //! bits in \c *this cannot be represented as type <tt>unsigned long long</tt>.
+ //! \returns \c x.
unsigned long long to_ullong() const
{
return bits.to_ulong();
}
+#ifdef BOOST_ENUMS_DOXYGEN_INVOKED
- //! 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.
+ //! <b> Effects:</b> Constructs a string object of the appropriate type and
+ //! initializes it to a string of length \c N characters. Each character is
+ //! determined by the value of its corresponding bit position in \c *this.
+ //! Character position \c 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().
+ //! \returns The created object.
+ template <class charT = char,
+ class traits = std::char_traits<charT>,
+ class Allocator = std::allocator<charT> >
+ std::basic_string<charT, traits, Allocator>
+ to_string(charT zero = charT('0'), charT one = charT('1')) const;
+#endif
+ //! <b> Effects:</b> Constructs an object x of class enum_set<EC> and initializes it with *this.
+ //! \returns \c 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);
+ //! \pre \c testing is valid
+ //! \throws out_of_range if the associated position of \c testing does not correspond to a valid bit position.
+ //! \returns \c true if the bit at position \c pos in \c *this has the value one.
+ bool test(EC testing);
- //! Returns: count() == size()
+ //! \returns <tt>count() == size()</tt>
bool all() const
{
return bits.all();
}
- //! Returns: count() != 0
+ //! \returns <tt>count() != 0</tt>
bool any() const
{
return bits.any();
}
- //! Returns: count() == 0
+ //! \returns <tt>count() == 0</tt>
bool none() const
{
return bits.none();
}
- //! Returns: enum_set<EC>(*this) <<= pos.
+ //! \returns <tt>enum_set<EC>(*this) <<= pos</tt>.
enum_set operator<<(std::size_t pos) const
{
enum_set r = *this;
@@ -308,7 +317,7 @@
return r;
}
- //! Returns: enum_set<EC>(*this) >>= pos.
+ //! \returns <tt>enum_set<EC>(*this) >>= pos</tt>.
enum_set operator>>(std::size_t pos) const
{
enum_set r = *this;
@@ -316,12 +325,12 @@
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 the value of each bit in \c *this equals the
+ //! value of the corresponding bit in \c rhs.
+ bool operator==(const enum_set& rhs) const;
- //! Returns: A nonzero value if !(*this == rhs).
-// bool operator!=(const enum_set& rhs) const;
+ //! \returns A nonzero value if <tt>!(*this == rhs)</tt>.
+ bool operator!=(const enum_set& rhs) const;
private:
static std::size_t to_bit(EC value)
@@ -338,7 +347,9 @@
// enum_set operators:
- //! Returns: enum_set<EC>(lhs) &= rhs.
+ //! Intersection
+
+ //! \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)
{
@@ -347,7 +358,9 @@
return r;
}
- //! Returns: enum_set<EC>>(lhs) |= rhs.
+ //! Union
+
+ //! \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)
{
@@ -356,7 +369,9 @@
return r;
}
- //! Returns: enum_set<EC>(lhs) = rhs.
+ //! Exclusive union
+
+ //! \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)
{
@@ -366,17 +381,21 @@
}
//! 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
+
+ //! \details <b> Effects:</b> Extracts up to \c N characters from is. Stores these characters
+ //! in a temporary object \c str of type <tt>basic_string<charT, traits></tt>, then
+ //! evaluates the expression <tt>x = enum_set<EC>(str)</tt>. Characters are extracted
//! and stored until any of the following occurs:
- //! - N characters have been extracted and stored;
+ //! - \c 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.
+ //! - the next input character is neither \c is.widen('0') nor \c is.widen('1')
+ //! (in which case the input character is not extracted).\n
+ //! If no characters are stored in \c str, calls \c is.setstate(ios_base::failbit)
+ //! (which may throw <tt>ios_- base::failure</tt>).
+ //! \param is the input stream.
+ //! \param x the \c enum_set.
+ //! \returns \c 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<EC/*,Traits*/>& x)
@@ -384,10 +403,13 @@
return is >> x.detail_bits();
}
- //! 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))
+ //! A formatted output function.
+
+ //! \param os the output stream.
+ //! \param x the \c enum_set.
+ //! \returns <tt>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'))</tt>
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<EC/*,Traits*/>& x)
@@ -398,11 +420,13 @@
} /* namespace enums */
- //! Requires: the template specialization shall meet the requirements of class template hash.
+ //! hash template specialization
+
template <typename EC/*, typename Traits*/ >
struct hash<enums::enum_set<EC/*,Traits*/> >
: public std::unary_function<enums::enum_set<EC/*,Traits*/>, std::size_t>
{
+ //! \details the template specialization meets the requirements of class template \c hash.
std::size_t operator()(const enums::enum_set<EC/*,Traits*/>& bs) const
{
return hash<std::bitset<enums::meta::size<EC>::size> >(bs.detail_bits());
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-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -21,15 +21,23 @@
#include <boost/enums/last.hpp>
#include <boost/conversion/convert_to.hpp>
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/linear_enum_traiter.hpp> declares a class template
+ \c meta::linear_enum_traiter<> which can be used as \c enum_trait<> helper for enumerations having a linear progression.
+ */
+
namespace boost {
namespace enums {
+ //! Helper class used as \c enum_trait<> for enumerations having a linear progression.
template <
typename EC
>
struct linear_enum_traiter
{
- protected:
+ private:
BOOST_STATIC_CONSTEXPR typename underlying_type<EC>::type first_value =
static_cast<typename underlying_type<EC>::type>(
enums::meta::val<EC,0>::value
@@ -40,15 +48,23 @@
);
BOOST_STATIC_CONSTEXPR std::size_t step = (last_value-first_value)/(meta::size<EC>::value-1);
public:
+ //! pos specialization.
+
+ //! \returns the returned value is calculated from the underlying value,
+ //! the \c first_value and the \c step, following this formula \c (ut-first_value)/step
static std::size_t pos(EC e)
{
- typename underlying_type<EC>::type ut = static_cast<typename underlying_type<EC>::type>(get_value(e));
- return (ut-first_value)/step;
+ typename underlying_type<EC>::type uv = static_cast<typename underlying_type<EC>::type>(get_value(e));
+ return (uv-first_value)/step;
}
- static EC val(std::size_t i)
+ //! val specialization.
+
+ //! \returns the returned value is calculated from the position \c p,
+ //! the first value and the step, following this formula \c p*step+first_value
+ static EC val(std::size_t p)
{
- typename underlying_type<EC>::type ut = i*step+first_value;
- return boost::convert_to<EC>(ut);
+ typename underlying_type<EC>::type uv = p*step+first_value;
+ return boost::convert_to<EC>(uv);
}
};
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-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,17 +10,37 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/enum_traits.hpp> declares a class template
+ \c meta::enum_traits<> which must be specialized for each enumeration including two static functions \c pos() and \c val().
+ */
+
#ifndef BOOST_ENUMS_ENUM_TRAITS_HPP
#define BOOST_ENUMS_ENUM_TRAITS_HPP
-namespace boost {
-namespace enums {
-namespace meta {
- template <typename EC>
- struct enum_traits;
+namespace boost
+{
+ namespace enums
+ {
+ namespace meta
+ {
+ template <typename EC>
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
+ struct enum_traits;
+#else
+ struct enum_traits
+ {
+ //! The specialization must define this function prototype
+ static std::size_t pos(EC e);
+ //! The specialization must define this function prototype
+ static EC val(std::size_t p);
+ };
+#endif
-}
-}
+ }
+ }
}
#endif
Modified: sandbox/enums/boost/enums/first.hpp
==============================================================================
--- sandbox/enums/boost/enums/first.hpp (original)
+++ sandbox/enums/boost/enums/first.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,7 @@
//
//////////////////////////////////////////////////////////////////////////////
+
#ifndef BOOST_ENUMS_FIRST_HPP
#define BOOST_ENUMS_FIRST_HPP
Modified: sandbox/enums/boost/enums/last.hpp
==============================================================================
--- sandbox/enums/boost/enums/last.hpp (original)
+++ sandbox/enums/boost/enums/last.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,13 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/last.hpp> declares a class template \c meta::last<> and
+ a function \c last() returning the last element of an enumeration.
+ */
+
#ifndef BOOST_ENUMS_LAST_HPP
#define BOOST_ENUMS_LAST_HPP
Modified: sandbox/enums/boost/enums/mpl/enum_c_tag.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/enum_c_tag.hpp (original)
+++ sandbox/enums/boost/enums/mpl/enum_c_tag.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -19,12 +19,14 @@
#include <boost/mpl/int.hpp>
-namespace boost {
-namespace mpl {
+namespace boost
+{
+ namespace mpl
+ {
+ //! Tag for the enum constants
+ struct enum_c_tag : int_<11> {};
-struct enum_c_tag : int_<11> {};
-
-}
+ }
}
#endif // BOOST_ENUMS_MPL_ENUM_C_TAG_HPP
Modified: sandbox/enums/boost/enums/mpl/equal_to.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/equal_to.hpp (original)
+++ sandbox/enums/boost/enums/mpl/equal_to.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -22,21 +22,24 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/equal_to.hpp>
-namespace boost {
-namespace mpl {
-
-template<>
-struct equal_to_impl< enum_c_tag,enum_c_tag >
+namespace boost
{
- template< typename E1, typename E2 > struct apply
+ namespace mpl
+ {
+
+ //! \c equal_to_impl specialization for \c enum_c_tag
+ template<>
+ struct equal_to_impl< enum_c_tag,enum_c_tag >
+ {
+ template< typename E1, typename E2 > struct apply
: equal_to<
integral_c<typename E1::underlying_type, (typename E1::underlying_type)(E1::value)>,
integral_c<typename E2::underlying_type, (typename E2::underlying_type)(E2::value)>
>
- {
+ {
+ };
};
-};
-}
+ }
}
#endif // BOOST_ENUMS_MPL_EQUAL_TO_HPP
Modified: sandbox/enums/boost/enums/mpl/greater.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/greater.hpp (original)
+++ sandbox/enums/boost/enums/mpl/greater.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -22,21 +22,24 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/greater.hpp>
-namespace boost {
-namespace mpl {
-
-template<>
-struct greater_impl< enum_c_tag,enum_c_tag >
+namespace boost
{
- template< typename R1, typename R2 > struct apply
+ namespace mpl
+ {
+
+ //! \c greater_impl specialization for \c enum_c_tag
+ template<>
+ struct greater_impl< enum_c_tag,enum_c_tag >
+ {
+ template< typename R1, typename R2 > struct apply
: greater<
integral_c<typename E1::underlying_type, (typename E1::underlying_type)(E1::value)>,
integral_c<typename E2::underlying_type, (typename E2::underlying_type)(E2::value)>
>
- {
+ {
+ };
};
-};
-}
+ }
}
#endif // BOOST_ENUMS_MPL_GREATER_HPP
Modified: sandbox/enums/boost/enums/mpl/greater_equal.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/greater_equal.hpp (original)
+++ sandbox/enums/boost/enums/mpl/greater_equal.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -22,21 +22,23 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/greater_equal.hpp>
-namespace boost {
-namespace mpl {
-
-template<>
-struct greater_equal_impl< enum_c_tag,enum_c_tag >
+namespace boost
{
- template< typename R1, typename R2 > struct apply
+ namespace mpl
+ {
+ //! \c greater_equal_impl specialization for \c enum_c_tag
+ template<>
+ struct greater_equal_impl< enum_c_tag,enum_c_tag >
+ {
+ template< typename R1, typename R2 > struct apply
: greater_equal<
integral_c<typename E1::underlying_type, (typename E1::underlying_type)(E1::value)>,
integral_c<typename E2::underlying_type, (typename E2::underlying_type)(E2::value)>
>
- {
- };
-};
-}
+ {
+ };
+ };
+ }
}
#endif // BOOST_ENUMS_MPL_GREATER_EQUAL_HPP
Modified: sandbox/enums/boost/enums/mpl/less.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/less.hpp (original)
+++ sandbox/enums/boost/enums/mpl/less.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -22,21 +22,25 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/less.hpp>
-namespace boost {
-namespace mpl {
-
-template<>
-struct less_impl< enum_c_tag,enum_c_tag >
+namespace boost
{
- template< typename R1, typename R2 > struct apply
+ namespace mpl
+ {
+
+ //! \c less_impl specialization for \c enum_c_tag
+
+ template<>
+ struct less_impl< enum_c_tag,enum_c_tag >
+ {
+ template< typename R1, typename R2 > struct apply
: less<
integral_c<typename E1::underlying_type, (typename E1::underlying_type)(E1::value)>,
integral_c<typename E2::underlying_type, (typename E2::underlying_type)(E2::value)>
>
- {
+ {
+ };
};
-};
-}
+ }
}
#endif // BOOST_ENUMS_MPL_LESS_HPP
Modified: sandbox/enums/boost/enums/mpl/less_equal.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/less_equal.hpp (original)
+++ sandbox/enums/boost/enums/mpl/less_equal.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -22,21 +22,23 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/less_equal.hpp>
-namespace boost {
-namespace mpl {
-
-template<>
-struct less_equal_impl< enum_c_tag,enum_c_tag >
+namespace boost
{
- template< typename R1, typename R2 > struct apply
+ namespace mpl
+ {
+ //! \c less_equal_impl specialization for \c enum_c_tag
+ template<>
+ struct less_equal_impl< enum_c_tag,enum_c_tag >
+ {
+ template< typename R1, typename R2 > struct apply
: less_equal<
integral_c<typename E1::underlying_type, (typename E1::underlying_type)(E1::value)>,
integral_c<typename E2::underlying_type, (typename E2::underlying_type)(E2::value)>
>
- {
+ {
+ };
};
-};
-}
+ }
}
#endif // BOOST_ENUMS_MPL_LESS_EQUAL_HPP
Modified: sandbox/enums/boost/enums/mpl/numeric_cast.hpp
==============================================================================
--- sandbox/enums/boost/enums/mpl/numeric_cast.hpp (original)
+++ sandbox/enums/boost/enums/mpl/numeric_cast.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -23,18 +23,19 @@
#include <boost/enums/mpl/enum_c_tag.hpp>
#include <boost/mpl/numeric_cast.hpp>
-namespace boost {
-namespace mpl {
-
-template<> struct numeric_cast< integral_c_tag,enum_c_tag >
+namespace boost
{
- template< typename N > struct apply
- : integral_c< typename N::underlying_type, N::value >
+ namespace mpl
+ {
+ //! \c numeric_cast specialization for \c integral_c_tag and \c enum_c_tag
+ template<> struct numeric_cast< integral_c_tag,enum_c_tag >
{
+ template< typename N > struct apply
+ : integral_c< typename N::underlying_type, N::value >
+ {
+ };
};
-};
-
-}
+ }
}
#endif // BOOST_ENUMS_MPL_NUMERIC_CAST_HPP
Modified: sandbox/enums/boost/enums/pos.hpp
==============================================================================
--- sandbox/enums/boost/enums/pos.hpp (original)
+++ sandbox/enums/boost/enums/pos.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,14 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/pos.hpp> declares a class template \c meta::pos<> and
+ a function \c pos() associating the an element of an enumeration to
+ its relative position.
+ */
+
#ifndef BOOST_ENUMS_POS_HPP
#define BOOST_ENUMS_POS_HPP
@@ -26,15 +34,28 @@
{
//! 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.
+
+ //! \note This meta-function must be specialized for each element of the enumeration.
template <typename EC, typename enum_type<EC>::type V>
- struct pos;
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
+ struct pos;
+#else
+ struct pos
+ {
+ constexpr std::size_t value=<to be defined for each specialization>;
+ };
+#endif
}
- //! Returns: the associated position
- //! The enum_traits class must be specialized and contain a pos function
- //! that returns the relative position.
- //! Throws: Nothing
+
+ //! position of an enum literal \c e on the extension of the enumeration type \c EC.
+
+ //! The \c enum_traits class must be specialized and contain a \c pos function
+ //! that returns the relative position of its argument \c e.
+
+ //! \param e the enum literal
+ //! \returns the associated position
+ //! \throws Nothing
template <typename EC>
std::size_t pos(EC e)
{
Modified: sandbox/enums/boost/enums/pred.hpp
==============================================================================
--- sandbox/enums/boost/enums/pred.hpp (original)
+++ sandbox/enums/boost/enums/pred.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,13 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/pred.hpp> declares a class template \c meta::pred<> and
+ a function \c pred() returning the predecessor of the enumeration element.
+ */
+
#ifndef BOOST_ENUMS_PRED_HPP
#define BOOST_ENUMS_PRED_HPP
Modified: sandbox/enums/boost/enums/size.hpp
==============================================================================
--- sandbox/enums/boost/enums/size.hpp (original)
+++ sandbox/enums/boost/enums/size.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,13 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/size.hpp> declares a class template \c meta::size<> and
+ a function \c size() returning the number of elements in the enumeration.
+ */
+
#ifndef BOOST_ENUMS_SIZE_HPP
#define BOOST_ENUMS_SIZE_HPP
@@ -19,8 +26,18 @@
namespace boost {
namespace enums {
namespace meta {
- template <typename EC>
- struct size;
+ //! meta-function used to get the number of elements of an enumeration.
+
+ //! \note This meta-function must be specialized for each enumeration.
+ template <typename EC>
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
+ struct size;
+#else
+ struct size
+ {
+ constexpr std::size_t value=<to be defined for each specialization>;
+ };
+#endif
}
template <typename EC>
std::size_t size()
Modified: sandbox/enums/boost/enums/succ.hpp
==============================================================================
--- sandbox/enums/boost/enums/succ.hpp (original)
+++ sandbox/enums/boost/enums/succ.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,13 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/succ.hpp> declares a class template \c meta::succ<> and
+ a function \c succ() returning the predecessor of the enumeration element.
+ */
+
#ifndef BOOST_ENUMS_SUCC_HPP
#define BOOST_ENUMS_SUCC_HPP
@@ -36,8 +43,12 @@
};
}
- //! Returns: the successor of the enumeration element
- //! Throws: Invalid parameter if the position is the last one
+
+ //! enum succesor.
+
+ //! param e the enum literal.
+ //! \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-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -22,14 +22,21 @@
{
namespace enums
{
+ //! underlying type metafunction
+
+ //! \c EC must be an enum type or the emulation of a scoped enum.\n\n
- //! 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.
+ //! The member typedef \c type name the underlying type of \c T.
+ //! When scoped enums are emulated it is defined as \c typename \c EC::underlying_type.
+ //! Otherwise is defined as \c std::underlying_type<EC>::type.
+ //! This meta-function must be specialized for the compilers providing scoped enums
+ //! but don't providing the \c std::underlying_type meta-function.
template <typename EC>
struct underlying_type
{
+#ifdef BOOST_ENUMS_DOXYGEN_INVOKED
+ typedef <see below> type;
+#else
#ifdef BOOST_NO_SCOPED_ENUMS
typedef typename EC::underlying_type type;
#else
@@ -37,6 +44,7 @@
typedef std::underlying_type<EC>::type type;
#endif
#endif
+#endif
};
}
}
Modified: sandbox/enums/boost/enums/val.hpp
==============================================================================
--- sandbox/enums/boost/enums/val.hpp (original)
+++ sandbox/enums/boost/enums/val.hpp 2011-03-13 11:34:10 EDT (Sun, 13 Mar 2011)
@@ -10,6 +10,13 @@
//
//////////////////////////////////////////////////////////////////////////////
+/*!
+ \file
+ \brief
+ The header \c <boost/enums/val.hpp> declares a class template \c meta::val<> and
+ a function \c val() associating a position to an element of an enumeration.
+ */
+
#ifndef BOOST_ENUMS_VALUE_HPP
#define BOOST_ENUMS_VALUE_HPP
@@ -25,13 +32,25 @@
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,
+
+ //! \note 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;
+#ifndef BOOST_ENUMS_DOXYGEN_INVOKED
+ struct val;
+#else
+ struct val
+ {
+ constexpr typename enum_type<EC>::type value=<to be defined for each specialization>;
+ };
+#endif
+
}
- //! Returns: The enum class element associated to the position
- //! Throws: Invalid parameter if the position is out of range
+ //! Value
+
+ //! \param p the position
+ //! \returns The enum class element associated to the position \c p.
+ //! \throws std::out_of_range if the position is out of range.
template <typename EC>
EC val(std::size_t 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