|
Boost-Commit : |
From: steven_watanabe_at_[hidden]
Date: 2007-06-06 14:03:52
Author: steven_watanabe
Date: 2007-06-06 14:03:50 EDT (Wed, 06 Jun 2007)
New Revision: 4473
URL: http://svn.boost.org/trac/boost/changeset/4473
Log:
less->mpl::less
Text files modified:
sandbox/units/boost/units/detail/dim_impl.hpp | 75 +++++++++++++--------------------------
sandbox/units/boost/units/detail/dimension_impl.hpp | 59 ++-----------------------------
sandbox/units/boost/units/heterogeneous_system.hpp | 18 ++++++--
sandbox/units/boost/units/scaled_base_unit.hpp | 18 ++++++++-
4 files changed, 57 insertions(+), 113 deletions(-)
Modified: sandbox/units/boost/units/detail/dim_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/dim_impl.hpp (original)
+++ sandbox/units/boost/units/detail/dim_impl.hpp 2007-06-06 14:03:50 EDT (Wed, 06 Jun 2007)
@@ -11,7 +11,7 @@
#ifndef BOOST_UNITS_DIM_IMPL_HPP
#define BOOST_UNITS_DIM_IMPL_HPP
-#include <boost/mpl/bool_fwd.hpp>
+#include <boost/mpl/bool.hpp>
#include <boost/mpl/less.hpp>
#include <boost/units/units_fwd.hpp>
@@ -19,65 +19,40 @@
/// \file
/// \brief Class encapsulating a dimension tag/value pair
-//namespace boost {
-//
-//namespace units {
-//
-//namespace detail {
-//
-//struct dim_tag { };
-//
-//} // namespace detail
-//
-///// \brief Dimension tag/exponent pair for a single fundamental dimension.
-/////
-///// \detailed
-///// The dim class represents a single dimension tag/dimension exponent pair.
-///// That is, @c dim<tag_type,value_type> is a pair where @c tag_type represents the
-///// fundamental dimension being represented and @c value_type represents the
-///// exponent of that fundamental dimension as a @c static_rational or other type
-///// providing the required compile-time arithmetic operations. @c tag_type must
-///// provide an ordinal value to allow sorting of lists of dims at compile-time.
-///// This can be easily accomplished by inheriting from @c ordinal<N>. Otherwise,
-///// @c tag_type may be any type.
-//template<typename T,typename V>
-//struct dim
-//{
-// typedef dim type;
-// typedef detail::dim_tag tag;
-// typedef T tag_type;
-// typedef V value_type;
-//};
-//
-//} // namespace units
-//
-//} // namespace boost
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::dim, 2)
-//
-//#endif
-
namespace boost {
namespace units {
namespace detail {
-/// Less than comparison for sorting @c dim.
-template<typename T,typename V> struct less;
+struct dim_tag;
+
+}
+
+}
-template<typename T1,typename V1,typename T2,typename V2>
-struct less< dim<T1,V1>,dim<T2,V2> >
+namespace mpl {
+
+/// Less than comparison for sorting @c dim.
+template<>
+struct less_impl<boost::units::detail::dim_tag, boost::units::detail::dim_tag>
{
- typedef typename boost::mpl::less<T1,T2>::type type;
-
- static const bool value = boost::is_same<type,boost::mpl::true_>::value;
+ template<class T0, class T1>
+ struct apply : mpl::less<typename T0::tag_type, typename T1::tag_type> {};
};
+}
+
+namespace units {
+
+template<class Tag, class Exponent>
+struct dim;
+
+template<long N, long D>
+class static_rational;
+
+namespace detail {
+
/// Extract @c tag_type from a @c dim.
template<typename T>
struct get_tag
Modified: sandbox/units/boost/units/detail/dimension_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/dimension_impl.hpp (original)
+++ sandbox/units/boost/units/detail/dimension_impl.hpp 2007-06-06 14:03:50 EDT (Wed, 06 Jun 2007)
@@ -18,6 +18,7 @@
#include <boost/mpl/next.hpp>
#include <boost/mpl/push_front.hpp>
#include <boost/mpl/size.hpp>
+#include <boost/mpl/less.hpp>
#include <boost/units/config.hpp>
#include <boost/units/dimension_list.hpp>
@@ -27,59 +28,7 @@
/// \file
/// \brief Core class and metaprogramming utilities for compile-time dimensional analysis.
-///
-/// \detailed
-//namespace boost {
-//
-//namespace units {
-//
-//struct dimensionless_type;
-//
-//}
-//
-//}
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TYPE(boost::units::dimensionless_type)
-//
-//#endif
-
-//namespace boost {
-//
-//namespace units {
-//
-//namespace detail {
-//
-//struct dimension_list_tag { };
-//
-//} // namespace detail
-//
-//template<class Item, class Next>
-//struct dimension_list
-//{
-// typedef detail::dimension_list_tag tag;
-// typedef dimension_list type;
-// typedef Item item;
-// typedef Next next;
-// typedef typename mpl::next<typename Next::size>::type size;
-//};
-//
-//}
-//
-//}
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::dimension_list, 2)
-//
-//#endif
-//
namespace boost {
namespace units {
@@ -233,7 +182,7 @@
{
typedef typename partition_dims_forward_impl<N - 1>::template apply<
typename Begin::next,
- typename partition_dims_state_insert<less<typename Begin::item, Value>::type::value>::template apply<State, typename Begin::item>::type,
+ typename partition_dims_state_insert<mpl::less<typename Begin::item, Value>::value>::template apply<State, typename Begin::item>::type,
Value
>::type type;
};
@@ -409,8 +358,8 @@
typedef typename boost::mpl::deref<Begin1>::type dim1;
typedef typename boost::mpl::deref<Begin2>::type dim2;
- typedef typename merge_dimensions_func<(less<dim1,dim2>::value == true),
- (less<dim2,dim1>::value == true)>::template apply<
+ typedef typename merge_dimensions_func<(mpl::less<dim1,dim2>::value == true),
+ (mpl::less<dim2,dim1>::value == true)>::template apply<
Begin1,
Begin2,
N1,
Modified: sandbox/units/boost/units/heterogeneous_system.hpp
==============================================================================
--- sandbox/units/boost/units/heterogeneous_system.hpp (original)
+++ sandbox/units/boost/units/heterogeneous_system.hpp 2007-06-06 14:03:50 EDT (Wed, 06 Jun 2007)
@@ -16,6 +16,7 @@
#include <boost/mpl/times.hpp>
#include <boost/mpl/divides.hpp>
#include <boost/mpl/negate.hpp>
+#include <boost/mpl/less.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/next.hpp>
@@ -97,15 +98,22 @@
namespace boost {
+namespace mpl {
+
+/// INTERNAL ONLY
+template<>
+struct less_impl<boost::units::heterogeneous_system_dim_tag, boost::units::heterogeneous_system_dim_tag>
+{
+ template<class T0, class T1>
+ struct apply : mpl::less<typename T0::tag_type, typename T1::tag_type> {};
+};
+
+}
+
namespace units {
namespace detail {
-template<class Unit1, class Exponent1, class Unit2, class Exponent2>
-struct less<heterogeneous_system_dim<Unit1,Exponent1>,heterogeneous_system_dim<Unit2,Exponent2> > :
- mpl::less<Unit1, Unit2>
-{};
-
template<class Unit1, class Exponent1>
struct is_empty_dim<heterogeneous_system_dim<Unit1,Exponent1> > : detail::is_zero<Exponent1> {};
Modified: sandbox/units/boost/units/scaled_base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/scaled_base_unit.hpp (original)
+++ sandbox/units/boost/units/scaled_base_unit.hpp 2007-06-06 14:03:50 EDT (Wed, 06 Jun 2007)
@@ -214,10 +214,22 @@
typedef scale_list_dim type;
};
-namespace detail {
+} // namespace units
+
+namespace mpl {
-template<class Scale1, class Scale2>
-struct less<scale_list_dim<Scale1>, scale_list_dim<Scale2> > : mpl::bool_<((Scale1::base) < (Scale2::base))> {};
+template<>
+struct less_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag>
+{
+ template<class T0, class T1>
+ struct apply : mpl::bool_<((T0::base) < (T1::base))> {};
+};
+
+}
+
+namespace units {
+
+namespace detail {
template<int N>
struct eval_scale_list_impl
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