$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r56066 - in trunk/boost/property_tree: . detail
From: sebastian.redl_at_[hidden]
Date: 2009-09-06 10:35:37
Author: cornedbee
Date: 2009-09-06 10:35:37 EDT (Sun, 06 Sep 2009)
New Revision: 56066
URL: http://svn.boost.org/trac/boost/changeset/56066
Log:
Hopefully fix all MSVC errors, and maybe even the Borland errors.
Text files modified: 
   trunk/boost/property_tree/detail/ptree_implementation.hpp |    19 ++++++++++++-----                       
   trunk/boost/property_tree/stream_translator.hpp           |    41 ++++++++++++++++++++++++++++++++++++--- 
   2 files changed, 50 insertions(+), 10 deletions(-)
Modified: trunk/boost/property_tree/detail/ptree_implementation.hpp
==============================================================================
--- trunk/boost/property_tree/detail/ptree_implementation.hpp	(original)
+++ trunk/boost/property_tree/detail/ptree_implementation.hpp	2009-09-06 10:35:37 EDT (Sun, 06 Sep 2009)
@@ -55,19 +55,22 @@
         iterator, typename subs::base_container::iterator, value_type>
     {
         friend class boost::iterator_core_access;
+        typedef boost::iterator_adaptor<
+            iterator, typename subs::base_container::iterator, value_type>
+            baset;
     public:
+        typedef typename baset::reference reference;
         iterator() {}
         explicit iterator(typename iterator::base_type b)
             : iterator::iterator_adaptor_(b)
         {}
-        typename iterator::reference dereference() const
+        reference dereference() const
         {
             // multi_index doesn't allow modification of its values, because
             // indexes could sort by anything, and modification screws that up.
             // However, we only sort by the key, and it's protected against
             // modification in the value_type, so this const_cast is safe.
-            return const_cast<typename iterator::reference>(
-                *this->base_reference());
+            return const_cast<reference>(*this->base_reference());
         }
     };
     template <class K, class D, class C>
@@ -114,15 +117,19 @@
                                          value_type>
     {
         friend class boost::iterator_core_access;
+        typedef boost::iterator_adaptor<assoc_iterator,
+                                         typename subs::by_name_index::iterator,
+                                         value_type>
+            baset;
     public:
+        typedef typename baset::reference reference;
         assoc_iterator() {}
         explicit assoc_iterator(typename assoc_iterator::base_type b)
             : assoc_iterator::iterator_adaptor_(b)
         {}
-        typename assoc_iterator::reference dereference() const
+        reference dereference() const
         {
-            return const_cast<typename assoc_iterator::reference>(
-                *this->base_reference());
+            return const_cast<reference>(*this->base_reference());
         }
     };
     template <class K, class D, class C>
Modified: trunk/boost/property_tree/stream_translator.hpp
==============================================================================
--- trunk/boost/property_tree/stream_translator.hpp	(original)
+++ trunk/boost/property_tree/stream_translator.hpp	2009-09-06 10:35:37 EDT (Sun, 06 Sep 2009)
@@ -17,6 +17,7 @@
 #include <boost/optional/optional_io.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/decay.hpp>
+#include <boost/type_traits/integral_constant.hpp>
 #include <sstream>
 #include <string>
 #include <locale>
@@ -52,12 +53,44 @@
         }
     };
 
+    // Ugly workaround for numeric_traits that don't have members when not
+    // specialized, e.g. MSVC.
+    namespace detail
+    {
+        template <bool is_specialized>
+        struct is_inexact_impl
+        {
+            template <typename T>
+            struct test
+            {
+                typedef boost::false_type type;
+            };
+        };
+        template <>
+        struct is_inexact_impl<true>
+        {
+            template <typename T>
+            struct test
+            {
+              typedef boost::integral_constant<bool,
+                  !std::numeric_limits<T>::is_exact> type;
+            };
+        };
+
+        template <typename F>
+        struct is_inexact
+        {
+            typedef typename boost::decay<F>::type decayed;
+            typedef typename is_inexact_impl<
+                std::numeric_limits<decayed>::is_specialized
+            >::BOOST_NESTED_TEMPLATE test<decayed>::type type;
+            static const bool value = type::value;
+        };
+    }
+
     template <typename Ch, typename Traits, typename F>
     struct customize_stream<Ch, Traits, F,
-        typename boost::enable_if_c<
-            std::numeric_limits<typename boost::decay<F>::type>::is_specialized
-            && !std::numeric_limits<typename boost::decay<F>::type>::is_exact
-        >::type
+        typename boost::enable_if< detail::is_inexact<F> >::type
     >
     {
         static void insert(std::basic_ostream<Ch, Traits>& s, const F& e) {