|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70217 - sandbox/enums/boost/enums/scoped
From: vicente.botet_at_[hidden]
Date: 2011-03-20 03:58:46
Author: viboes
Date: 2011-03-20 03:58:44 EDT (Sun, 20 Mar 2011)
New Revision: 70217
URL: http://svn.boost.org/trac/boost/changeset/70217
Log:
Enums: cleanup + Added missing includes
Text files modified:
sandbox/enums/boost/enums/scoped/enum_class_cons.hpp | 25 +------
sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp | 5 +
sandbox/enums/boost/enums/scoped/enum_type_cons.hpp | 130 ++-------------------------------------
sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp | 107 +-------------------------------
4 files changed, 25 insertions(+), 242 deletions(-)
Modified: sandbox/enums/boost/enums/scoped/enum_class_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_class_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_class_cons.hpp 2011-03-20 03:58:44 EDT (Sun, 20 Mar 2011)
@@ -20,6 +20,11 @@
#define BOOST_ENUMS_SCOPED_ENUM_TYPE_CONS_HPP
#include <boost/config.hpp>
+#include <boost/conversion/convert_to.hpp>
+#include <boost/enums/scoped/underlying_type.hpp>
+#include <boost/enums/scoped/underlying_value.hpp>
+#include <boost/enums/scoped/native_type.hpp>
+#include <boost/enums/scoped/native_value.hpp>
namespace boost
{
@@ -191,26 +196,6 @@
{
return lhs.val_ > rhs;
}
-#if 0
- //! conversions from underlying_type to enum_type_cons following the Boost.Conversion protocol
- friend enum_class_cons convert_to(underlying_type v,
- boost::dummy::type_tag<enum_class_cons> const&)
- {
- enum_class_cons res;
- res.val_=v;
- return res;
-
- }
-
- //! friend conversions from type to enum_type_cons following the Boost.Conversion protocol
- friend enum_class_cons convert_to(type v,
- boost::dummy::type_tag<enum_class_cons> const&)
- {
- enum_class_cons res;
- res.val_=static_cast<underlying_type>(v);
- return res;
- }
-#endif
//! conversions from enum_type_cons to underlying_type following the Boost.Conversion protocol
friend underlying_type convert_to(enum_class_cons v,
boost::dummy::type_tag<underlying_type> const&)
Modified: sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_class_no_cons.hpp 2011-03-20 03:58:44 EDT (Sun, 20 Mar 2011)
@@ -20,6 +20,11 @@
#define BOOST_ENUMS_SCOPED_ENUM_TYPE_NO_CONS_HPP
#include <boost/config.hpp>
+#include <boost/conversion/convert_to.hpp>
+#include <boost/enums/scoped/underlying_type.hpp>
+#include <boost/enums/scoped/underlying_value.hpp>
+#include <boost/enums/scoped/native_type.hpp>
+#include <boost/enums/scoped/native_value.hpp>
namespace boost
{
Modified: sandbox/enums/boost/enums/scoped/enum_type_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_type_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_type_cons.hpp 2011-03-20 03:58:44 EDT (Sun, 20 Mar 2011)
@@ -20,18 +20,24 @@
#define BOOST_ENUMS_SCOPED_ENUM_TYPE_CONS_HPP
#include <boost/config.hpp>
+#include <boost/conversion/convert_to.hpp>
+#include <boost/enums/scoped/underlying_type.hpp>
+#include <boost/enums/scoped/underlying_value.hpp>
+#include <boost/enums/scoped/native_type.hpp>
+#include <boost/enums/scoped/native_value.hpp>
namespace boost
{
namespace enums
{
+
//! scoped enum type with constructors
//! param @c ScopedEnum : Struct scoping the enum.\n
//! param @c UT : the underlaying storage type.\n
//! pre @c ScopedEnum must have a nested C++98 enum @c type.\n
template <typename ScopedEnum, typename UT=int>
- class enum_type_cons : public ScopedEnum
+ class enum_type_cons : public ScopedEnum
{
public:
//! c++98 enum type
@@ -59,13 +65,7 @@
{
}
-#if 0
- //! implicit conversion to underlying_type
- operator underlying_type()
- {
- return val_;
- }
-#endif
+
//! implicit conversion to enum type
operator type()
{
@@ -118,119 +118,7 @@
{
return val_;
}
-#if 0
- //! equal operator
- friend bool operator==(enum_type_cons lhs, enum_type_cons rhs)
- {
- return lhs.val_ == rhs.val_;
- }
- //! equal operator
- friend bool operator==(type lhs, enum_type_cons rhs)
- {
- return lhs == rhs.val_;
- }
-
- //! equal operator
- friend bool operator==(enum_type_cons lhs, type rhs)
- {
- return lhs.val_ == rhs;
- }
- //! not_equal operator
- friend bool operator!=(enum_type_cons lhs, enum_type_cons rhs)
- {
- return lhs.val_ != rhs.val_;
- }
- //! not_equal operator
- friend bool operator!=(type lhs, enum_type_cons rhs)
- {
- return lhs != rhs.val_;
- }
- //! not_equal operator
- friend bool operator!=(enum_type_cons lhs, type rhs)
- {
- return lhs.val_ != rhs;
- }
- //! less_equal operator
- friend bool operator<=(enum_type_cons lhs, enum_type_cons rhs)
- {
- return lhs.val_ <= rhs.val_;
- }
- //! less_equal operator
- friend bool operator<=(type lhs, enum_type_cons rhs)
- {
- return lhs <= rhs.val_;
- }
- //! less_equal operator
- friend bool operator<=(enum_type_cons lhs, type rhs)
- {
- return lhs.val_ <= rhs;
- }
- //! less operator
- friend bool operator<(enum_type_cons lhs, enum_type_cons rhs)
- {
- return lhs.val_ < rhs.val_;
- }
- //! less operator
- friend bool operator<(type lhs, enum_type_cons rhs)
- {
- return lhs < rhs.val_;
- }
- //! less operator
- friend bool operator<(enum_type_cons lhs, type rhs)
- {
- return lhs.val_ < rhs;
- }
- //! greater_equal operator
- friend bool operator>=(enum_type_cons lhs, enum_type_cons rhs)
- {
- return lhs.val_ >= rhs.val_;
- }
- //! greater_equal operator
- friend bool operator>=(type lhs, enum_type_cons rhs)
- {
- return lhs >= rhs.val_;
- }
- //! greater_equal operator
- friend bool operator>=(enum_type_cons lhs, type rhs)
- {
- return lhs.val_ >= rhs;
- }
- //! greater operator
- friend bool operator>(enum_type_cons lhs, enum_type_cons rhs)
- {
- return lhs.val_ > rhs.val_;
- }
- //! greater operator
- friend bool operator>(type lhs, enum_type_cons rhs)
- {
- return lhs > rhs.val_;
- }
- //! greater operator
- friend bool operator>(enum_type_cons lhs, type rhs)
- {
- return lhs.val_ > rhs;
- }
-#endif
-#if 0
- //! conversions from underlying_type to enum_type_cons following the Boost.Conversion protocol
- friend enum_type_cons convert_to(underlying_type v,
- boost::dummy::type_tag<enum_type_cons> const&)
- {
- enum_type_cons res;
- res.val_=v;
- return res;
-
- }
-
- //! friend conversions from type to enum_type_cons following the Boost.Conversion protocol
- friend enum_type_cons convert_to(type v,
- boost::dummy::type_tag<enum_type_cons> const&)
- {
- enum_type_cons res;
- res.val_=static_cast<underlying_type>(v);
- return res;
- }
-#endif
+
//! conversions from enum_type_cons to underlying_type following the Boost.Conversion protocol
friend underlying_type convert_to(enum_type_cons v,
boost::dummy::type_tag<underlying_type> const&)
Modified: sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp
==============================================================================
--- sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp (original)
+++ sandbox/enums/boost/enums/scoped/enum_type_no_cons.hpp 2011-03-20 03:58:44 EDT (Sun, 20 Mar 2011)
@@ -20,6 +20,11 @@
#define BOOST_ENUMS_SCOPED_ENUM_TYPE_NO_CONS_HPP
#include <boost/config.hpp>
+#include <boost/conversion/convert_to.hpp>
+#include <boost/enums/scoped/underlying_type.hpp>
+#include <boost/enums/scoped/underlying_value.hpp>
+#include <boost/enums/scoped/native_type.hpp>
+#include <boost/enums/scoped/native_value.hpp>
namespace boost
{
@@ -41,15 +46,7 @@
private:
underlying_type val_;
public:
-
-#if 0
- //! implicit conversion to underlying_type
- operator underlying_type()
- {
- return val_;
- }
-#endif
-
+
//! implicit conversion to enum type
operator type()
{
@@ -102,99 +99,7 @@
{
return val_;
}
-#if 0
- //! equal operator
- friend bool operator==(enum_type_no_cons lhs, enum_type_no_cons rhs)
- {
- return lhs.val_ == rhs.val_;
- }
- //! equal operator
- friend bool operator==(type lhs, enum_type_no_cons rhs)
- {
- return lhs == rhs.val_;
- }
- //! equal operator
- friend bool operator==(enum_type_no_cons lhs, type rhs)
- {
- return lhs.val_ == rhs;
- }
- //! not_equal operator
- friend bool operator!=(enum_type_no_cons lhs, enum_type_no_cons rhs)
- {
- return lhs.val_ != rhs.val_;
- }
- //! not_equal operator
- friend bool operator!=(type lhs, enum_type_no_cons rhs)
- {
- return lhs != rhs.val_;
- }
- //! not_equal operator
- friend bool operator!=(enum_type_no_cons lhs, type rhs)
- {
- return lhs.val_ != rhs;
- }
- //! less_equal operator
- friend bool operator<=(enum_type_no_cons lhs, enum_type_no_cons rhs)
- {
- return lhs.val_ <= rhs.val_;
- }
- //! less_equal operator
- friend bool operator<=(type lhs, enum_type_no_cons rhs)
- {
- return lhs <= rhs.val_;
- }
- //! less_equal operator
- friend bool operator<=(enum_type_no_cons lhs, type rhs)
- {
- return lhs.val_ <= rhs;
- }
- //! less operator
- friend bool operator<(enum_type_no_cons lhs, enum_type_no_cons rhs)
- {
- return lhs.val_ < rhs.val_;
- }
- //! less operator
- friend bool operator<(type lhs, enum_type_no_cons rhs)
- {
- return lhs < rhs.val_;
- }
- //! less operator
- friend bool operator<(enum_type_no_cons lhs, type rhs)
- {
- return lhs.val_ < rhs;
- }
- //! greater_equal operator
- friend bool operator>=(enum_type_no_cons lhs, enum_type_no_cons rhs)
- {
- return lhs.val_ >= rhs.val_;
- }
- //! greater_equal operator
- friend bool operator>=(type lhs, enum_type_no_cons rhs)
- {
- return lhs >= rhs.val_;
- }
- //! greater_equal operator
- friend bool operator>=(enum_type_no_cons lhs, type rhs)
- {
- return lhs.val_ >= rhs;
- }
- //! greater operator
- friend bool operator>(enum_type_no_cons lhs, enum_type_no_cons rhs)
- {
- return lhs.val_ > rhs.val_;
- }
- //! greater operator
- friend bool operator>(type lhs, enum_type_no_cons rhs)
- {
- return lhs > rhs.val_;
- }
- //! greater operator
- friend bool operator>(enum_type_no_cons lhs, type rhs)
- {
- return lhs.val_ > rhs;
- }
-#endif
//! conversions from underlying_type to enum_type_cons following the Boost.Conversion protocol
friend enum_type_no_cons convert_to(underlying_type v,
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