Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r70795 - trunk/boost/units
From: steven_at_[hidden]
Date: 2011-03-31 14:28:34


Author: steven_watanabe
Date: 2011-03-31 14:28:33 EDT (Thu, 31 Mar 2011)
New Revision: 70795
URL: http://svn.boost.org/trac/boost/changeset/70795

Log:
Simplify the dispatching. Hopefully this will help intel.
Text files modified:
   trunk/boost/units/io.hpp | 30 ++++++++++++++++++++----------
   1 files changed, 20 insertions(+), 10 deletions(-)

Modified: trunk/boost/units/io.hpp
==============================================================================
--- trunk/boost/units/io.hpp (original)
+++ trunk/boost/units/io.hpp 2011-03-31 14:28:33 EDT (Thu, 31 Mar 2011)
@@ -895,8 +895,7 @@
>
>,
         T
- >& q,
- mpl::true_)
+ >& q)
 {
     quantity<
         unit<
@@ -932,8 +931,7 @@
>
>,
         T
- >& q,
- mpl::true_)
+ >& q)
 {
     quantity<
         unit<
@@ -952,13 +950,25 @@
 }
 
 template<class Prefixes, class CharT, class Traits, class Dimension, class System, class T>
-void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<unit<Dimension, System>, T>& q, mpl::true_ norm_test)
+void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<unit<Dimension, System>, T>& q)
 {
- detail::do_print_prefixed<Prefixes>(os, quantity<unit<Dimension, typename make_heterogeneous_system<Dimension, System>::type>, T>(q), norm_test);
+ detail::do_print_prefixed<Prefixes>(os, quantity<unit<Dimension, typename make_heterogeneous_system<Dimension, System>::type>, T>(q));
 }
 
-template<class Prefixes, class CharT, class Traits, class Unit, class T, class NormTest>
-void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q, NormTest)
+template<class Prefixes, class CharT, class Traits, class Unit, class T>
+void do_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q)
+{
+ detail::print_default(os, q)();
+}
+
+template<class Prefixes, class CharT, class Traits, class Unit, class T>
+void maybe_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q, mpl::true_)
+{
+ detail::do_print_prefixed<Prefixes>(os, q);
+}
+
+template<class Prefixes, class CharT, class Traits, class Unit, class T>
+void maybe_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<Unit, T>& q, mpl::false_)
 {
     detail::print_default(os, q)();
 }
@@ -1037,11 +1047,11 @@
     }
     else if (units::get_autoprefix(os) == autoprefix_engineering)
     {
- detail::do_print_prefixed<detail::engineering_prefixes>(os, q, detail::test_norm(autoprefix_norm(q.value())));
+ detail::maybe_print_prefixed<detail::engineering_prefixes>(os, q, detail::test_norm(autoprefix_norm(q.value())));
     }
     else if (units::get_autoprefix(os) == autoprefix_binary)
     {
- detail::do_print_prefixed<detail::binary_prefixes>(os, q, detail::test_norm(autoprefix_norm(q.value())));
+ detail::maybe_print_prefixed<detail::binary_prefixes>(os, q, detail::test_norm(autoprefix_norm(q.value())));
     }
     else
     {


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