|
Boost-Commit : |
From: steven_watanabe_at_[hidden]
Date: 2007-06-05 18:21:42
Author: steven_watanabe
Date: 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
New Revision: 4459
URL: http://svn.boost.org/trac/boost/changeset/4459
Log:
Cleaned up #includes
Text files modified:
sandbox/units/boost/units/absolute.hpp | 65 ++++++++++++-----------
sandbox/units/boost/units/base_dimension.hpp | 1
sandbox/units/boost/units/base_unit.hpp | 2
sandbox/units/boost/units/cmath.hpp | 2
sandbox/units/boost/units/config.hpp | 5 -
sandbox/units/boost/units/conversion.hpp | 40 ++++++++------
sandbox/units/boost/units/derived_dimension.hpp | 3 +
sandbox/units/boost/units/detail/linear_algebra.hpp | 1
sandbox/units/boost/units/dim.hpp | 27 +--------
sandbox/units/boost/units/dimension.hpp | 11 +--
sandbox/units/boost/units/dimensionless_quantity.hpp | 2
sandbox/units/boost/units/dimensionless_unit.hpp | 5 -
sandbox/units/boost/units/heterogeneous_system.hpp | 20 +++++--
sandbox/units/boost/units/homogeneous_system.hpp | 17 ++++-
sandbox/units/boost/units/io.hpp | 65 +++++++++++++++---------
sandbox/units/boost/units/make_system.hpp | 2
sandbox/units/boost/units/operators.hpp | 3 -
sandbox/units/boost/units/quantity.hpp | 19 ++++---
sandbox/units/boost/units/scaled_base_unit.hpp | 106 ++++++++++++++++++++++++++-------------
sandbox/units/boost/units/static_constant.hpp | 2
sandbox/units/boost/units/static_rational.hpp | 10 ---
sandbox/units/boost/units/systems/trig.hpp | 1
sandbox/units/boost/units/unit.hpp | 5 +
sandbox/units/libs/units/example/tutorial.cpp | 2
sandbox/units/libs/units/example/unit_example_3.cpp | 2
sandbox/units/libs/units/example/unit_example_4.cpp | 2
26 files changed, 240 insertions(+), 180 deletions(-)
Modified: sandbox/units/boost/units/absolute.hpp
==============================================================================
--- sandbox/units/boost/units/absolute.hpp (original)
+++ sandbox/units/boost/units/absolute.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -17,6 +17,8 @@
#include <boost/units/config.hpp>
#include <boost/units/conversion.hpp>
+#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/units_fwd.hpp>
namespace boost {
@@ -80,10 +82,12 @@
struct affine_conversion_impl;
template<bool ReverseIsDefined>
-struct affine_conversion_impl<true, ReverseIsDefined> {
+struct affine_conversion_impl<true, ReverseIsDefined>
+{
template<class Unit1, class Unit2, class T0, class T1>
struct apply {
- static T1 value(const T0& t0) {
+ static T1 value(const T0& t0)
+ {
return(
t0 *
conversion_factor(Unit1(), Unit2()) +
@@ -93,10 +97,13 @@
};
template<>
-struct affine_conversion_impl<false, true> {
+struct affine_conversion_impl<false, true>
+{
template<class Unit1, class Unit2, class T0, class T1>
- struct apply {
- static T1 value(const T0& t0) {
+ struct apply
+ {
+ static T1 value(const T0& t0)
+ {
return(
(t0 - affine_conversion_helper<typename reduce_unit<Unit2>::type, typename reduce_unit<Unit1>::type>::value()) *
conversion_factor(Unit1(), Unit2()));
@@ -107,10 +114,12 @@
}
template<class Unit1, class T1, class Unit2, class T2>
-struct conversion_helper<quantity<absolute<Unit1>, T1>, quantity<absolute<Unit2>, T2> > {
+struct conversion_helper<quantity<absolute<Unit1>, T1>, quantity<absolute<Unit2>, T2> >
+{
typedef quantity<absolute<Unit1>, T1> from_quantity_type;
typedef quantity<absolute<Unit2>, T2> to_quantity_type;
- static to_quantity_type convert(const from_quantity_type& source) {
+ static to_quantity_type convert(const from_quantity_type& source)
+ {
return(
to_quantity_type::from_value(
detail::affine_conversion_impl<
@@ -137,16 +146,17 @@
/// specify the conversion factor. Like @c BOOST_UNITS_DEFINE_CONVERSION
/// defining celsius->fahrenheit as above will be sufficient
/// to get fahrenheit->celsius also.
-#define BOOST_UNITS_DEFINE_AFFINE_CONVERSION(From, To, type_, value_)\
- namespace boost {\
- namespace units {\
- template<>\
- struct affine_conversion_helper<From, To> {\
- typedef type_ type;\
- static type value() {return(value_);}\
- };\
- }\
- }\
+#define BOOST_UNITS_DEFINE_AFFINE_CONVERSION(From, To, type_, value_) \
+ namespace boost { \
+ namespace units { \
+ template<> \
+ struct affine_conversion_helper<From, To> \
+ { \
+ typedef type_ type; \
+ static type value() { return(value_); } \
+ }; \
+ } \
+ } \
void boost_units_require_semicolon()
/// add a relative value to an absolute one
@@ -177,30 +187,24 @@
return Y(aval1.value()-aval2.value());
}
-template<class U, class T>
-class quantity;
-
template<class D, class S>
-class unit;
-
-template<class Unit>
-struct reduce_unit;
-
-template<class D, class S>
-struct reduce_unit<absolute<unit<D, S> > > {
+struct reduce_unit<absolute<unit<D, S> > >
+{
typedef absolute<typename reduce_unit<unit<D, S> >::type> type;
};
/// multiplying an absolute unit by a scalar gives a quantity
/// just like an ordinary unit
template<class D, class S, class T>
-quantity<absolute<unit<D, S> >, T> operator*(const T& t, const absolute<unit<D, S> >&) {
+quantity<absolute<unit<D, S> >, T> operator*(const T& t, const absolute<unit<D, S> >&)
+{
return(quantity<absolute<unit<D, S> >, T>::from_value(t));
}
/// multiplying an absolute unit by a scalar gives a quantity
/// just like an ordinary unit
template<class D, class S, class T>
-quantity<absolute<unit<D, S> >, T> operator*(const absolute<unit<D, S> >&, const T& t) {
+quantity<absolute<unit<D, S> >, T> operator*(const absolute<unit<D, S> >&, const T& t)
+{
return(quantity<absolute<unit<D, S> >, T>::from_value(t));
}
@@ -208,8 +212,7 @@
template<class Y>
std::ostream& operator<<(std::ostream& os,const absolute<Y>& aval)
{
- using namespace std;
-
+
os << "absolute " << aval.value();
return os;
Modified: sandbox/units/boost/units/base_dimension.hpp
==============================================================================
--- sandbox/units/boost/units/base_dimension.hpp (original)
+++ sandbox/units/boost/units/base_dimension.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -47,7 +47,6 @@
{
public:
typedef base_dimension this_type;
- //typedef mpl::long_<N> value;
typedef dimension_list<dim<Derived,static_rational<1> >, dimensionless_type> type;
private:
Modified: sandbox/units/boost/units/base_unit.hpp
==============================================================================
--- sandbox/units/boost/units/base_unit.hpp (original)
+++ sandbox/units/boost/units/base_unit.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -12,7 +12,6 @@
#define BOOST_UNITS_BASE_UNIT_HPP
#include <boost/units/config.hpp>
-#include <boost/units/dim.hpp>
#include <boost/units/dimension_list.hpp>
#include <boost/units/heterogeneous_system.hpp>
#include <boost/units/static_rational.hpp>
@@ -51,7 +50,6 @@
{
public:
typedef base_unit this_type;
- //typedef mpl::long_<N> value;
typedef Dim dimension_type;
typedef Derived type;
Modified: sandbox/units/boost/units/cmath.hpp
==============================================================================
--- sandbox/units/boost/units/cmath.hpp (original)
+++ sandbox/units/boost/units/cmath.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,6 +11,8 @@
#ifndef BOOST_UNITS_CMATH_HPP
#define BOOST_UNITS_CMATH_HPP
+#include <cmath>
+
#include <boost/units/quantity.hpp>
#include <boost/units/detail/cmath_impl.hpp>
Modified: sandbox/units/boost/units/config.hpp
==============================================================================
--- sandbox/units/boost/units/config.hpp (original)
+++ sandbox/units/boost/units/config.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,8 +11,8 @@
#ifndef BOOST_UNITS_CONFIG_HPP
#define BOOST_UNITS_CONFIG_HPP
-#include <boost/version.hpp>
#include <boost/config.hpp>
+#include <boost/version.hpp>
#if (BOOST_VERSION >= 103400)
#define BOOST_UNITS_HAS_BOOST_TYPEOF 1
@@ -25,8 +25,7 @@
//#define BOOST_UNITS_HAS_BOOST_TYPEOF 0
#if (BOOST_UNITS_HAS_BOOST_TYPEOF)
- #include <boost/typeof/typeof.hpp>
- #include <boost/typeof/std/complex.hpp>
+ #include <boost/typeof/typeof.hpp>
#define BOOST_UNITS_HAS_TYPEOF 1
#else
#if (__GNUC__ && __cplusplus && __GNUC__ >= 3)
Modified: sandbox/units/boost/units/conversion.hpp
==============================================================================
--- sandbox/units/boost/units/conversion.hpp (original)
+++ sandbox/units/boost/units/conversion.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -17,24 +17,22 @@
#include <boost/mpl/next.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/divides.hpp>
+#include <boost/type_traits/is_same.hpp>
-#include <boost/units/scaled_base_unit.hpp>
-#include <boost/units/homogeneous_system.hpp>
+#include <boost/units/dimension_list.hpp>
#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/homogeneous_system.hpp>
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/detail/heterogeneous_conversion.hpp>
#include <boost/units/detail/one.hpp>
#include <boost/units/detail/static_rational_power.hpp>
-#include <boost/units/detail/heterogeneous_conversion.hpp>
namespace boost {
namespace units {
-template<class Dimension, class System>
-class unit;
-
-template<class Unit, class T>
-class quantity;
-
template<class From, class To>
struct conversion_helper;
@@ -155,7 +153,7 @@
(boost::is_same<typename Dest::unit_type, typename selector::destination_type>::value) };
};
-}
+} // namespace detail
/// INTERNAL ONLY
template<class Source, class Dest>
@@ -339,7 +337,8 @@
struct conversion_factor_helper;
template<class D, class L1, class L2>
-struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, homogeneous_system<L2> > > {
+struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, homogeneous_system<L2> > >
+{
typedef typename reduce_unit<unit<D, homogeneous_system<L1> > >::type source_unit;
typedef typename source_unit::system_type::type unit_list;
typedef typename detail::conversion_impl<mpl::size<unit_list>::value>::template apply<
@@ -347,19 +346,22 @@
homogeneous_system<L2>
> impl;
typedef typename impl::type type;
- static type value() {
+ static type value()
+ {
return(impl::value());
}
};
template<class D, class L1, class L2>
-struct conversion_factor_helper<unit<D, heterogeneous_system<L1> >, unit<D, homogeneous_system<L2> > > {
+struct conversion_factor_helper<unit<D, heterogeneous_system<L1> >, unit<D, homogeneous_system<L2> > >
+{
typedef typename detail::conversion_impl<mpl::size<typename L1::type>::value>::template apply<
typename mpl::begin<typename L1::type>::type,
homogeneous_system<L2>
> impl;
typedef typename impl::type type;
- static type convert() {
+ static type convert()
+ {
return(impl::value());
}
};
@@ -368,18 +370,20 @@
// other than just defining it as the reverse of the
// heterogeneous->homogeneous case
template<class D, class L1, class L2>
-struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, heterogeneous_system<L2> > > {
+struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, heterogeneous_system<L2> > >
+{
typedef typename detail::conversion_impl<mpl::size<typename L2::type>::value>::template apply<
typename mpl::begin<typename L2::type>::type,
homogeneous_system<L1>
> impl;
typedef typename impl::type type;
- static type value() {
+ static type value()
+ {
return(one() / impl::value());
}
};
-}
+} // namespace detail
/// Find the conversion factor between two units.
template<class FromUnit,class ToUnit>
@@ -400,7 +404,7 @@
return(static_cast<Y>(detail::conversion_factor_helper<FromUnit, ToUnit>::value()));
}
-} //namespace units
+} // namespace units
} // namespace boost
Modified: sandbox/units/boost/units/derived_dimension.hpp
==============================================================================
--- sandbox/units/boost/units/derived_dimension.hpp (original)
+++ sandbox/units/boost/units/derived_dimension.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -13,6 +13,9 @@
#include <boost/mpl/list.hpp>
+#include <boost/units/dim.hpp>
+#include <boost/units/dimension.hpp>
+#include <boost/units/dimension_list.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/units_fwd.hpp>
Modified: sandbox/units/boost/units/detail/linear_algebra.hpp
==============================================================================
--- sandbox/units/boost/units/detail/linear_algebra.hpp (original)
+++ sandbox/units/boost/units/detail/linear_algebra.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -29,6 +29,7 @@
#include <boost/mpl/advance.hpp>
#include <boost/mpl/erase.hpp>
#include <boost/mpl/front.hpp>
+#include <boost/mpl/and.hpp>
#include <boost/units/detail/sort.hpp>
Modified: sandbox/units/boost/units/dim.hpp
==============================================================================
--- sandbox/units/boost/units/dim.hpp (original)
+++ sandbox/units/boost/units/dim.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,36 +11,19 @@
#ifndef BOOST_UNITS_DIM_HPP
#define BOOST_UNITS_DIM_HPP
-#include <boost/mpl/bool_fwd.hpp>
-#include <boost/mpl/int.hpp>
+#include <boost/static_assert.hpp>
+
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/mpl/arithmetic.hpp>
#include <boost/units/config.hpp>
-#include <boost/units/is_dim.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/detail/dim_impl.hpp>
/// \file
/// \brief Handling of fundamental dimension/exponent pairs.
-//namespace boost {
-//
-//namespace units {
-//
-///// Class for defining a cardinal ordering of tags to faciliate compile-time sorting.
-//template<long N> struct ordinal { typedef typename boost::mpl::int_<N> value; };
-//
-//}
-//
-//}
-//
-//#if BOOST_UNITS_HAS_BOOST_TYPEOF
-//
-//#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
-//
-//BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::ordinal, (long))
-//
-//#endif
-
namespace boost {
namespace units {
Modified: sandbox/units/boost/units/dimension.hpp
==============================================================================
--- sandbox/units/boost/units/dimension.hpp (original)
+++ sandbox/units/boost/units/dimension.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -13,17 +13,14 @@
#include <boost/static_assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+
#include <boost/mpl/arithmetic.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/begin_end.hpp>
-#include <boost/mpl/bool_fwd.hpp>
-#include <boost/mpl/is_sequence.hpp>
-#include <boost/mpl/list.hpp>
-#include <boost/mpl/long.hpp>
+#include <boost/mpl/begin.hpp>
#include <boost/mpl/size.hpp>
#include <boost/units/dim.hpp>
-#include <boost/units/dimensionless_type.hpp>
+#include <boost/units/dimension_list.hpp>
#include <boost/units/operators.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/detail/dimension_impl.hpp>
Modified: sandbox/units/boost/units/dimensionless_quantity.hpp
==============================================================================
--- sandbox/units/boost/units/dimensionless_quantity.hpp (original)
+++ sandbox/units/boost/units/dimensionless_quantity.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -12,7 +12,7 @@
#define BOOST_UNITS_DIMENSIONLESS_QUANTITY_HPP
#include <boost/units/dimensionless_unit.hpp>
-#include <boost/units/units_fwd.hpp>
+#include <boost/units/quantity.hpp>
namespace boost {
Modified: sandbox/units/boost/units/dimensionless_unit.hpp
==============================================================================
--- sandbox/units/boost/units/dimensionless_unit.hpp (original)
+++ sandbox/units/boost/units/dimensionless_unit.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,9 +11,8 @@
#ifndef BOOST_UNITS_DIMENSIONLESS_UNIT_HPP
#define BOOST_UNITS_DIMENSIONLESS_UNIT_HPP
-//#include <boost/units/dimensionless_type.hpp>
-#include <boost/units/dimension.hpp>
-#include <boost/units/units_fwd.hpp>
+#include <boost/units/dimensionless_type.hpp>
+#include <boost/units/unit.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 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -15,16 +15,20 @@
#include <boost/mpl/plus.hpp>
#include <boost/mpl/times.hpp>
#include <boost/mpl/divides.hpp>
+#include <boost/mpl/negate.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/front.hpp>
+#include <boost/mpl/push_front.hpp>
+#include <boost/mpl/pop_front.hpp>
#include <boost/units/config.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/dimension.hpp>
#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/units_fwd.hpp>
#include <boost/units/detail/push_front_if.hpp>
#include <boost/units/detail/linear_algebra.hpp>
@@ -45,7 +49,7 @@
template<>
struct is_zero<static_rational<0> > : mpl::true_ {};
-}
+} // namespace detail
/// INTERNAL ONLY
template<class L, class Dimensions>
@@ -263,13 +267,17 @@
/// Returns a unique type for every unit.
template<class Unit>
-struct reduce_unit
+struct reduce_unit;
+
+/// Returns a unique type for every unit.
+template<class Dim, class System>
+struct reduce_unit<unit<Dim, System> >
{
typedef unit<
- typename Unit::dimension_type,
+ Dim,
typename detail::make_heterogeneous_system<
- typename Unit::dimension_type,
- typename Unit::system_type
+ Dim,
+ System
>::type
> type;
};
@@ -344,7 +352,7 @@
};
};
-}
+} // namespace detail
/// Unscale all the base units. e.g
/// km s -> m s
Modified: sandbox/units/boost/units/homogeneous_system.hpp
==============================================================================
--- sandbox/units/boost/units/homogeneous_system.hpp (original)
+++ sandbox/units/boost/units/homogeneous_system.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,6 +11,8 @@
#ifndef BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
#define BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
+#include <boost/mpl/bool.hpp>
+
#include <boost/units/config.hpp>
#include <boost/units/static_rational.hpp>
@@ -32,13 +34,21 @@
typedef L type;
};
+template<class T, class E>
+struct static_power;
+
+template<class T, class R>
+struct static_root;
+
template<class L, long N, long D>
-struct static_power<homogeneous_system<L>, static_rational<N,D> > {
+struct static_power<homogeneous_system<L>, static_rational<N,D> >
+{
typedef homogeneous_system<L> type;
};
template<class L, long N, long D>
-struct static_root<homogeneous_system<L>, static_rational<N,D> > {
+struct static_root<homogeneous_system<L>, static_rational<N,D> >
+{
typedef homogeneous_system<L> type;
};
@@ -64,8 +74,7 @@
#else
template<class L, class Dimensions>
-struct check_system<homogeneous_system<L>, Dimensions> : mpl::true_ {
-};
+struct check_system<homogeneous_system<L>, Dimensions> : mpl::true_ {};
#endif
Modified: sandbox/units/boost/units/io.hpp
==============================================================================
--- sandbox/units/boost/units/io.hpp (original)
+++ sandbox/units/boost/units/io.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -20,9 +20,10 @@
#include <boost/mpl/deref.hpp>
#include <boost/serialization/nvp.hpp>
-#include <boost/units/unit.hpp>
-#include <boost/units/quantity.hpp>
#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/quantity.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/unit.hpp>
namespace boost {
@@ -60,18 +61,18 @@
return os;
}
-template<class T>
-struct heterogeneous_system;
-
/// traits template for unit names
template<class BaseUnit>
-struct base_unit_info {
+struct base_unit_info
+{
/// The full name of the unit (returns BaseUnit::name() by default)
- static std::string name() {
+ static std::string name()
+ {
return(BaseUnit::name());
}
/// The symbol for the base unit (Returns BaseUnit::symbol() by default)
- static std::string symbol() {
+ static std::string symbol()
+ {
return(BaseUnit::symbol());
}
};
@@ -79,31 +80,38 @@
namespace detail {
template<class T>
-const T& adapt_for_print(const T& t) {
+const T& adapt_for_print(const T& t)
+{
return(t);
}
template<class Char, class Traits, class Allocator>
-const Char* adapt_for_print(const std::basic_string<Char, Traits, Allocator>& s) {
+const Char* adapt_for_print(const std::basic_string<Char, Traits, Allocator>& s)
+{
return(s.c_str());
}
template<class T, class Os>
-void print_base_unit(Os& os, const T&) {
+void print_base_unit(Os& os, const T&)
+{
os << (adapt_for_print)(base_unit_info<typename T::tag_type>::symbol()) << '^' << typename T::value_type();
}
template<class Unit, class Os>
-void print_base_unit(Os& os, const heterogeneous_system_dim<Unit, static_rational<1> >&) {
+void print_base_unit(Os& os, const heterogeneous_system_dim<Unit, static_rational<1> >&)
+{
os << (adapt_for_print)(base_unit_info<Unit>::symbol());
}
template<int N>
-struct print_impl {
+struct print_impl
+{
template<class Begin, class Os>
- struct apply {
+ struct apply
+ {
typedef typename print_impl<N-1>::template apply<typename mpl::next<Begin>::type, Os> next;
- static void value(Os& os) {
+ static void value(Os& os)
+ {
(print_base_unit)(os, typename mpl::deref<Begin>::type());
os << ' ';
next::value(os);
@@ -112,20 +120,26 @@
};
template<>
-struct print_impl<1> {
+struct print_impl<1>
+{
template<class Begin, class Os>
- struct apply {
- static void value(Os& os) {
+ struct apply
+ {
+ static void value(Os& os)
+ {
(print_base_unit)(os, typename mpl::deref<Begin>::type());
};
};
};
template<>
-struct print_impl<0> {
+struct print_impl<0>
+{
template<class Begin, class Os>
- struct apply {
- static void value(Os& os) {
+ struct apply
+ {
+ static void value(Os& os)
+ {
os << "dimensionless";
}
};
@@ -135,14 +149,16 @@
/// Print an @c unit as a list of base units and exponents e.g "m s^-1"
template<class Char, class Traits, class Dimension, class System>
-std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>&) {
+std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>&)
+{
os << typename reduce_unit<unit<Dimension, System> >::type();
return(os);
}
/// INTERNAL ONLY
template<class Char, class Traits, class Dimension, class System>
-std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, heterogeneous_system<System> >&) {
+std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, heterogeneous_system<System> >&)
+{
detail::print_impl<mpl::size<typename System::type>::value>::template apply<
typename mpl::begin<typename System::type>::type,
std::basic_ostream<Char, Traits> >::value(os);
@@ -151,7 +167,8 @@
/// Print a @c quantity. Prints the value followed by the unit
template<class Char, class Traits, class Unit, class T>
-std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const quantity<Unit, T>& q) {
+std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const quantity<Unit, T>& q)
+{
os << q.value() << ' ' << Unit();
return(os);
}
Modified: sandbox/units/boost/units/make_system.hpp
==============================================================================
--- sandbox/units/boost/units/make_system.hpp (original)
+++ sandbox/units/boost/units/make_system.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -14,6 +14,8 @@
#include <boost/mpl/list/list10.hpp>
#include <boost/units/config.hpp>
+#include <boost/units/dimensionless_type.hpp>
+#include <boost/units/dimension_list.hpp>
#include <boost/units/homogeneous_system.hpp>
#include <boost/units/detail/sort.hpp>
Modified: sandbox/units/boost/units/operators.hpp
==============================================================================
--- sandbox/units/boost/units/operators.hpp (original)
+++ sandbox/units/boost/units/operators.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,9 +11,6 @@
#ifndef BOOST_UNITS_OPERATORS_HPP
#define BOOST_UNITS_OPERATORS_HPP
-#include <cmath>
-#include <complex>
-
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_same.hpp>
Modified: sandbox/units/boost/units/quantity.hpp
==============================================================================
--- sandbox/units/boost/units/quantity.hpp (original)
+++ sandbox/units/boost/units/quantity.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -14,21 +14,23 @@
#include <algorithm>
#include <boost/config.hpp>
-#include <boost/mpl/bool_fwd.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/mpl/bool.hpp>
#include <boost/mpl/and.hpp>
+#include <boost/mpl/not.hpp>
#include <boost/mpl/or.hpp>
#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
+#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_same.hpp>
-#include <boost/units/dimensionless_quantity.hpp>
-#include <boost/units/get_dimension.hpp>
-#include <boost/units/get_system.hpp>
-#include <boost/units/unit.hpp>
-#include <boost/units/units_fwd.hpp>
#include <boost/units/conversion.hpp>
+#include <boost/units/dimensionless_type.hpp>
#include <boost/units/homogeneous_system.hpp>
+#include <boost/units/operators.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/units_fwd.hpp>
namespace boost {
@@ -64,7 +66,8 @@
// msvc 7.1 needs extra disambiguation
template<class T, class U>
-struct disable_if_is_same {
+struct disable_if_is_same
+{
typedef void type;
};
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-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -13,8 +13,19 @@
#include <string>
-#include <boost/units/dimension.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/plus.hpp>
+#include <boost/mpl/times.hpp>
+#include <boost/mpl/negate.hpp>
+#include <boost/mpl/less.hpp>
+#include <boost/type_traits/is_same.hpp>
+
#include <boost/units/config.hpp>
+#include <boost/units/dimension.hpp>
#include <boost/units/static_rational.hpp>
#include <boost/units/detail/one.hpp>
#include <boost/units/detail/static_rational_power.hpp>
@@ -36,7 +47,8 @@
struct heterogeneous_system_dim;
template<long Base, class Exponent>
-struct scale {
+struct scale
+{
enum { base = Base };
typedef Exponent exponent;
typedef double value_type;
@@ -44,7 +56,8 @@
};
template<long Base>
-struct scale<Base, static_rational<0> > {
+struct scale<Base, static_rational<0> >
+{
static const long base = Base;
typedef static_rational<0> exponent;
typedef one value_type;
@@ -123,10 +136,12 @@
>
> unit_type;
- static std::string symbol() {
+ static std::string symbol()
+ {
return(Scale::symbol_prefix() + S::symbol());
}
- static std::string name() {
+ static std::string name()
+ {
return(Scale::name_prefix() + S::name());
}
};
@@ -149,12 +164,14 @@
namespace units {
template<class T>
-struct unscale {
+struct unscale
+{
typedef T type;
};
template<class S, class Scale>
-struct unscale<scaled_base_unit<S, Scale> > {
+struct unscale<scaled_base_unit<S, Scale> >
+{
typedef typename unscale<S>::type type;
};
@@ -162,7 +179,8 @@
class unit;
template<class D, class S>
-struct unscale<unit<D, S> > {
+struct unscale<unit<D, S> >
+{
typedef unit<D, typename unscale<S>::type> type;
};
@@ -170,24 +188,28 @@
struct scale_list_dim;
template<class T>
-struct get_scale_list {
+struct get_scale_list
+{
typedef dimensionless_type type;
};
template<class S, class Scale>
-struct get_scale_list<scaled_base_unit<S, Scale> > {
+struct get_scale_list<scaled_base_unit<S, Scale> >
+{
typedef typename mpl::times<dimension_list<scale_list_dim<Scale>, dimensionless_type>, typename get_scale_list<S>::type>::type type;
};
template<class D, class S>
-struct get_scale_list<unit<D, S> > {
+struct get_scale_list<unit<D, S> >
+{
typedef typename get_scale_list<S>::type type;
};
struct scale_dim_tag {};
template<class Scale>
-struct scale_list_dim : Scale {
+struct scale_list_dim : Scale
+{
typedef scale_dim_tag tag;
typedef scale_list_dim type;
};
@@ -195,27 +217,32 @@
namespace detail {
template<class Scale1, class Scale2>
-struct less<scale_list_dim<Scale1>, scale_list_dim<Scale2> > : mpl::bool_<((Scale1::base) < (Scale2::base))> {
-};
+struct less<scale_list_dim<Scale1>, scale_list_dim<Scale2> > : mpl::bool_<((Scale1::base) < (Scale2::base))> {};
template<int N>
-struct eval_scale_list_impl {
+struct eval_scale_list_impl
+{
template<class Begin>
- struct apply {
+ struct apply
+ {
typedef typename eval_scale_list_impl<N-1>::template apply<typename mpl::next<Begin>::type> next_iteration;
typedef typename multiply_typeof_helper<typename next_iteration::type, typename mpl::deref<Begin>::type::value_type>::type type;
- static type value() {
+ static type value()
+ {
return(next_iteration::value() * mpl::deref<Begin>::type::value());
}
};
};
template<>
-struct eval_scale_list_impl<0> {
+struct eval_scale_list_impl<0>
+{
template<class Begin>
- struct apply {
+ struct apply
+ {
typedef one type;
- static type value() {
+ static type value()
+ {
return(type());
}
};
@@ -224,17 +251,18 @@
}
template<class T>
-struct eval_scale_list : detail::eval_scale_list_impl<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type> {
-};
+struct eval_scale_list : detail::eval_scale_list_impl<mpl::size<T>::value>::template apply<typename mpl::begin<T>::type> {};
} // namespace units
namespace mpl {
template<>
-struct plus_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag> {
+struct plus_impl<boost::units::scale_dim_tag, boost::units::scale_dim_tag>
+{
template<class T0, class T1>
- struct apply {
+ struct apply
+ {
typedef boost::units::scale_list_dim<
boost::units::scale<
(T0::base),
@@ -245,9 +273,11 @@
};
template<>
-struct negate_impl<boost::units::scale_dim_tag> {
+struct negate_impl<boost::units::scale_dim_tag>
+{
template<class T0>
- struct apply {
+ struct apply
+ {
typedef boost::units::scale_list_dim<
boost::units::scale<
(T0::base),
@@ -258,9 +288,11 @@
};
template<>
-struct times_impl<boost::units::scale_dim_tag, boost::units::detail::static_rational_tag> {
+struct times_impl<boost::units::scale_dim_tag, boost::units::detail::static_rational_tag>
+{
template<class T0, class T1>
- struct apply {
+ struct apply
+ {
typedef boost::units::scale_list_dim<
boost::units::scale<
(T0::base),
@@ -271,33 +303,33 @@
};
template<class Tag>
-struct less_impl<boost::units::scaled_base_unit_tag, Tag> {
+struct less_impl<boost::units::scaled_base_unit_tag, Tag>
+{
template<class T0, class T1>
struct apply : mpl::bool_<
((mpl::less<typename T0::system_type, T1>::value) ||
- ((boost::is_same<typename T0::system_type, T1>::value) && ((T0::scale_type::exponent::Numerator) < 0)))> {
- };
+ ((boost::is_same<typename T0::system_type, T1>::value) && ((T0::scale_type::exponent::Numerator) < 0)))> {};
};
template<class Tag>
-struct less_impl<Tag, boost::units::scaled_base_unit_tag> {
+struct less_impl<Tag, boost::units::scaled_base_unit_tag>
+{
template<class T0, class T1>
struct apply : mpl::bool_<
((mpl::less<T0, typename T1::system_type>::value) ||
- ((boost::is_same<T0, typename T1::system_type>::value) && ((T1::scale_type::exponent::Numerator) > 0)))> {
- };
+ ((boost::is_same<T0, typename T1::system_type>::value) && ((T1::scale_type::exponent::Numerator) > 0)))> {};
};
template<>
-struct less_impl<boost::units::scaled_base_unit_tag, boost::units::scaled_base_unit_tag> {
+struct less_impl<boost::units::scaled_base_unit_tag, boost::units::scaled_base_unit_tag>
+{
template<class T0, class T1>
struct apply : mpl::bool_<
((mpl::less<typename T0::system_type, typename T1::system_type>::value) ||
((boost::is_same<typename T0::system_type, typename T1::system_type>::value) &&
(((T0::scale_type::base) < (T1::scale_type::base)) ||
(((T0::scale_type::base) == (T1::scale_type::base)) &&
- (mpl::less<typename T0::scale_type::exponent,typename T1::scale_type::exponent>::value)))))> {
- };
+ (mpl::less<typename T0::scale_type::exponent,typename T1::scale_type::exponent>::value)))))> {};
};
} // namespace mpl
Modified: sandbox/units/boost/units/static_constant.hpp
==============================================================================
--- sandbox/units/boost/units/static_constant.hpp (original)
+++ sandbox/units/boost/units/static_constant.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -11,6 +11,8 @@
#ifndef BOOST_UNITS_STATIC_CONSTANT_HPP
#define BOOST_UNITS_STATIC_CONSTANT_HPP
+#include <boost/units/config.hpp>
+
/// A convenience macro that allows definition of static
/// constants in headers in an ODR-safe way.
#define BOOST_UNITS_STATIC_CONSTANT(name, type) \
Modified: sandbox/units/boost/units/static_rational.hpp
==============================================================================
--- sandbox/units/boost/units/static_rational.hpp (original)
+++ sandbox/units/boost/units/static_rational.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -15,9 +15,9 @@
#include <complex>
#include <boost/math/common_factor_ct.hpp>
+#include <boost/mpl/less.hpp>
#include <boost/mpl/arithmetic.hpp>
#include <boost/mpl/less.hpp>
-#include <boost/type_traits/is_same.hpp>
#include <boost/units/operators.hpp>
@@ -92,14 +92,6 @@
static_rational() { }
//~static_rational() { }
-// // static rationals are implicitly convertible if reduced types are the same
-// template<integer_type NN,integer_type DD>
-// operator static_rational<NN,DD>()
-// {
-// BOOST_STATIC_ASSERT((boost::is_same<type,typename static_rational<NN,DD>::type>::value == true));
-//
-// return static_rational<NN,DD>();
-// }
};
}
Modified: sandbox/units/boost/units/systems/trig.hpp
==============================================================================
--- sandbox/units/boost/units/systems/trig.hpp (original)
+++ sandbox/units/boost/units/systems/trig.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -13,6 +13,7 @@
#include <cmath>
+#include <boost/units/dimensionless_quantity.hpp>
#include <boost/units/quantity.hpp>
#include <boost/units/systems/si/plane_angle.hpp>
Modified: sandbox/units/boost/units/unit.hpp
==============================================================================
--- sandbox/units/boost/units/unit.hpp (original)
+++ sandbox/units/boost/units/unit.hpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -12,13 +12,16 @@
#define BOOST_UNITS_UNIT_HPP
#include <boost/static_assert.hpp>
-#include <boost/mpl/bool_fwd.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/type_traits/is_same.hpp>
#include <boost/units/config.hpp>
#include <boost/units/dimension.hpp>
+#include <boost/units/operators.hpp>
#include <boost/units/units_fwd.hpp>
#include <boost/units/homogeneous_system.hpp>
#include <boost/units/heterogeneous_system.hpp>
+#include <boost/units/static_rational.hpp>
#include <boost/units/detail/unit_impl.hpp>
namespace boost {
Modified: sandbox/units/libs/units/example/tutorial.cpp
==============================================================================
--- sandbox/units/libs/units/example/tutorial.cpp (original)
+++ sandbox/units/libs/units/example/tutorial.cpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -38,6 +38,8 @@
#include <complex>
#include <iostream>
+#include <boost/typeof/std/complex.hpp>
+
#include <boost/units/io.hpp>
#include <boost/units/systems/si/energy.hpp>
#include <boost/units/systems/si/force.hpp>
Modified: sandbox/units/libs/units/example/unit_example_3.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_3.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_3.cpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -59,6 +59,8 @@
#include <boost/mpl/list.hpp>
+#include <boost/typeof/std/complex.hpp>
+
#include <boost/units/quantity.hpp>
#include <boost/units/io.hpp>
Modified: sandbox/units/libs/units/example/unit_example_4.cpp
==============================================================================
--- sandbox/units/libs/units/example/unit_example_4.cpp (original)
+++ sandbox/units/libs/units/example/unit_example_4.cpp 2007-06-05 18:21:39 EDT (Tue, 05 Jun 2007)
@@ -141,6 +141,8 @@
#include <algorithm>
#include <sstream>
+#include <boost/typeof/std/complex.hpp>
+
#include <boost/units/io.hpp>
#include <boost/units/systems/si.hpp>
#include <boost/units/systems/trig.hpp>
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