|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73701 - trunk/libs/numeric/conversion/test
From: blkohn_at_[hidden]
Date: 2011-08-12 09:09:16
Author: brandon.kohn
Date: 2011-08-12 09:09:15 EDT (Fri, 12 Aug 2011)
New Revision: 73701
URL: http://svn.boost.org/trac/boost/changeset/73701
Log:
Simplified custom numeric type in numeric_cast_traits_test.cpp to reduce template depth.
Text files modified:
trunk/libs/numeric/conversion/test/numeric_cast_traits_test.cpp | 40 +++++++++++++++++++---------------------
1 files changed, 19 insertions(+), 21 deletions(-)
Modified: trunk/libs/numeric/conversion/test/numeric_cast_traits_test.cpp
==============================================================================
--- trunk/libs/numeric/conversion/test/numeric_cast_traits_test.cpp (original)
+++ trunk/libs/numeric/conversion/test/numeric_cast_traits_test.cpp 2011-08-12 09:09:15 EDT (Fri, 12 Aug 2011)
@@ -16,26 +16,6 @@
//! Define a simple custom number
struct Double
- : boost::ordered_field_operators
- <
- Double
- , boost::ordered_field_operators2< Double, long double
- , boost::ordered_field_operators2< Double, double
- , boost::ordered_field_operators2< Double, float
- , boost::ordered_field_operators2< Double, boost::int8_t
- , boost::ordered_field_operators2< Double, boost::uint8_t
- , boost::ordered_field_operators2< Double, boost::int16_t
- , boost::ordered_field_operators2< Double, boost::uint16_t
- , boost::ordered_field_operators2< Double, boost::int32_t
- , boost::ordered_field_operators2< Double, boost::uint32_t
-#if !defined( BOOST_NO_INT64_T )
- , boost::ordered_field_operators2< Double, boost::int64_t
- , boost::ordered_field_operators2< Double, boost::uint64_t
-#endif
- > > > > > > > > > >
-#if !defined( BOOST_NO_INT64_T )
- > >
-#endif
{
Double()
: v(0)
@@ -64,10 +44,22 @@
return v < static_cast<double>(rhs);
}
+ template <typename LHS>
+ friend bool operator < ( const LHS& lhs, const Double& rhs )
+ {
+ return lhs < rhs.v;
+ }
+
bool operator > ( const Double& rhs ) const
{
return v > rhs.v;
}
+
+ template <typename LHS>
+ friend bool operator > ( const LHS& lhs, const Double& rhs )
+ {
+ return lhs > rhs.v;
+ }
template <typename T>
bool operator > ( T rhs ) const
@@ -75,7 +67,7 @@
return v > static_cast<double>(rhs);
}
- bool operator ==( const Double& rhs ) const
+ bool operator == ( const Double& rhs ) const
{
return v == rhs.v;
}
@@ -85,6 +77,12 @@
{
return v == static_cast<double>(rhs);
}
+
+ template <typename LHS>
+ friend bool operator == ( const LHS& lhs, const Double& rhs )
+ {
+ return lhs == rhs.v;
+ }
bool operator !() const
{
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