|
Boost-Commit : |
From: boost_at_[hidden]
Date: 2008-05-26 17:22:03
Author: matthiasschabel
Date: 2008-05-26 17:22:03 EDT (Mon, 26 May 2008)
New Revision: 45792
URL: http://svn.boost.org/trac/boost/changeset/45792
Log:
add inlines
Text files modified:
sandbox/units/boost/units/io.hpp | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
Modified: sandbox/units/boost/units/io.hpp
==============================================================================
--- sandbox/units/boost/units/io.hpp (original)
+++ sandbox/units/boost/units/io.hpp 2008-05-26 17:22:03 EDT (Mon, 26 May 2008)
@@ -163,7 +163,7 @@
namespace detail {
template<integer_type N, integer_type D>
-std::string exponent_string(const static_rational<N,D>& r)
+inline std::string exponent_string(const static_rational<N,D>& r)
{
return '^' + to_string(r);
}
@@ -175,13 +175,13 @@
}
template<class T>
-std::string base_unit_symbol_string(const T&)
+inline std::string base_unit_symbol_string(const T&)
{
return base_unit_info<typename T::tag_type>::symbol() + exponent_string(typename T::value_type());
}
template<class T>
-std::string base_unit_name_string(const T&)
+inline std::string base_unit_name_string(const T&)
{
return base_unit_info<typename T::tag_type>::name() + exponent_string(typename T::value_type());
}
@@ -290,7 +290,6 @@
{
static void value(std::string& str)
{
- // better shorthand for dimensionless?
str += "dimensionless";
}
};
@@ -347,6 +346,7 @@
typename mpl::begin<typename System::scale>::type>::value(str);
detail::symbol_string_impl<mpl::size<typename System::type>::value>::template apply<
typename mpl::begin<typename System::type>::type>::value(str);
+
return(str);
}
@@ -360,18 +360,20 @@
typename mpl::begin<typename System::scale>::type>::value(str);
detail::name_string_impl<mpl::size<typename System::type>::value>::template apply<
typename mpl::begin<typename System::type>::type>::value(str);
+
return(str);
}
/// 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>
+inline
std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const unit<Dimension, System>& u)
{
- if(units::get_format(os) == symbol)
+ if (units::get_format(os) == symbol)
{
os << symbol_string(u);
}
- else if(units::get_format(os) == name)
+ else if (units::get_format(os) == name)
{
os << name_string(u);
}
@@ -386,7 +388,7 @@
/// INTERNAL ONLY
/// 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)
+inline std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, const quantity<Unit, T>& q)
{
os << q.value() << ' ' << Unit();
return(os);
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