|
Boost-Commit : |
From: steven_at_[hidden]
Date: 2008-05-14 14:41:04
Author: steven_watanabe
Date: 2008-05-14 14:41:04 EDT (Wed, 14 May 2008)
New Revision: 45358
URL: http://svn.boost.org/trac/boost/changeset/45358
Log:
Separated out reduce_unit
Added:
sandbox/units/boost/units/reduce_unit.hpp (contents, props changed)
Text files modified:
sandbox/units/boost/units/detail/conversion_impl.hpp | 1 +
sandbox/units/boost/units/detail/implicit_conversion.hpp | 1 +
sandbox/units/boost/units/heterogeneous_system.hpp | 30 ++----------------------------
sandbox/units/boost/units/unit.hpp | 14 ++++++++++++++
4 files changed, 18 insertions(+), 28 deletions(-)
Modified: sandbox/units/boost/units/detail/conversion_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/conversion_impl.hpp (original)
+++ sandbox/units/boost/units/detail/conversion_impl.hpp 2008-05-14 14:41:04 EDT (Wed, 14 May 2008)
@@ -24,6 +24,7 @@
#include <boost/units/dimension_list.hpp>
#include <boost/units/heterogeneous_system.hpp>
#include <boost/units/homogeneous_system.hpp>
+#include <boost/units/reduce_unit.hpp>
#include <boost/units/scale.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
Modified: sandbox/units/boost/units/detail/implicit_conversion.hpp
==============================================================================
--- sandbox/units/boost/units/detail/implicit_conversion.hpp (original)
+++ sandbox/units/boost/units/detail/implicit_conversion.hpp 2008-05-14 14:41:04 EDT (Wed, 14 May 2008)
@@ -19,6 +19,7 @@
#include <boost/units/operators.hpp>
#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/reduce_unit.hpp>
#include <boost/units/units_fwd.hpp>
namespace boost {
Modified: sandbox/units/boost/units/heterogeneous_system.hpp
==============================================================================
--- sandbox/units/boost/units/heterogeneous_system.hpp (original)
+++ sandbox/units/boost/units/heterogeneous_system.hpp 2008-05-14 14:41:04 EDT (Wed, 14 May 2008)
@@ -64,8 +64,8 @@
/// A system that can represent any possible combination
/// of units at the expense of not preserving information
/// about how it was created. Do not create specializations
-/// of this template directly. Instead use reduce_unit and
-/// base_unit<...>::unit_type.
+/// of this template directly. Instead use @c reduce_unit and
+/// @c base_unit<...>::unit_type.
template<class T>
struct heterogeneous_system : T {};
@@ -292,32 +292,6 @@
> type;
};
-template<class Unit>
-struct reduce_unit;
-
-#ifdef BOOST_UNITS_DOXYGEN
-
-/// Returns a unique type for every unit.
-template<class Unit>
-struct reduce_unit {
- typedef detail::unspecified type;
-};
-
-#endif
-
-/// Returns a unique type for every unit.
-template<class Dim, class System>
-struct reduce_unit<unit<Dim, System> >
-{
- typedef unit<
- Dim,
- typename detail::make_heterogeneous_system<
- Dim,
- System
- >::type
- > type;
-};
-
namespace detail {
template<int N>
Added: sandbox/units/boost/units/reduce_unit.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/reduce_unit.hpp 2008-05-14 14:41:04 EDT (Wed, 14 May 2008)
@@ -0,0 +1,38 @@
+// mcs::units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2007 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNITS_REDUCE_UNIT_HPP_INCLUDED
+#define BOOST_UNITS_REDUCE_UNIT_HPP_INCLUDED
+
+namespace boost {
+namespace units {
+
+#ifdef BOOST_UNITS_DOXYGEN
+
+/// Returns a unique type for every unit.
+template<class Unit>
+struct reduce_unit {
+ typedef detail::unspecified type;
+};
+
+#else
+
+// default implementation: return Unit unchanged.
+template<class Unit>
+struct reduce_unit {
+ typedef Unit type;
+};
+
+#endif
+
+}
+}
+
+#endif
Modified: sandbox/units/boost/units/unit.hpp
==============================================================================
--- sandbox/units/boost/units/unit.hpp (original)
+++ sandbox/units/boost/units/unit.hpp 2008-05-14 14:41:04 EDT (Wed, 14 May 2008)
@@ -22,6 +22,7 @@
#include <boost/units/homogeneous_system.hpp>
#include <boost/units/heterogeneous_system.hpp>
#include <boost/units/is_dimension_list.hpp>
+#include <boost/units/reduce_unit.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/detail/implicit_conversion.hpp>
@@ -68,6 +69,19 @@
namespace units {
+/// Returns a unique type for every unit.
+template<class Dim, class System>
+struct reduce_unit<unit<Dim, System> >
+{
+ typedef unit<
+ Dim,
+ typename detail::make_heterogeneous_system<
+ Dim,
+ System
+ >::type
+ > type;
+};
+
//template<class S1,class S2> struct is_implicitly_convertible;
#ifdef BOOST_UNITS_ENABLE_IMPLICIT_UNIT_CONVERSION
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