$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r54398 - in branches/release: . boost boost/variant libs/variant/doc/reference libs/variant/test
From: daniel_james_at_[hidden]
Date: 2009-06-27 03:34:42
Author: danieljames
Date: 2009-06-27 03:34:42 EDT (Sat, 27 Jun 2009)
New Revision: 54398
URL: http://svn.boost.org/trac/boost/changeset/54398
Log:
Support BOOST_NO_TYPEID and BOOST_NO_IOSTREAM in Boost.Variant. Fixes #3051.
Merged revisions 53682 via svnmerge from 
https://svn.boost.org/svn/boost/trunk
........
  r53682 | danieljames | 2009-06-06 12:46:24 +0100 (Sat, 06 Jun 2009) | 1 line
  
  Support BOOST_NO_TYPEID and BOOST_NO_IOSTREAM in Boost.Variant. Fixes #3051.
........
Properties modified: 
   branches/release/   (props changed)
Text files modified: 
   branches/release/boost/blank.hpp                        |     8 +++++++-                                
   branches/release/boost/variant/variant.hpp              |    13 +++++++++++++                           
   branches/release/libs/variant/doc/reference/variant.xml |    11 +++++++++++                             
   branches/release/libs/variant/test/jobs.h               |    27 ++++-----------------------             
   branches/release/libs/variant/test/test3.cpp            |     2 ++                                      
   5 files changed, 37 insertions(+), 24 deletions(-)
Modified: branches/release/boost/blank.hpp
==============================================================================
--- branches/release/boost/blank.hpp	(original)
+++ branches/release/boost/blank.hpp	2009-06-27 03:34:42 EDT (Sat, 27 Jun 2009)
@@ -15,9 +15,11 @@
 
 #include "boost/blank_fwd.hpp"
 
+#if !defined(BOOST_NO_IOSTREAM)
 #include <iosfwd> // for std::basic_ostream forward declare
-
 #include "boost/detail/templated_streams.hpp"
+#endif // BOOST_NO_IOSTREAM
+
 #include "boost/mpl/bool.hpp"
 #include "boost/type_traits/is_empty.hpp"
 #include "boost/type_traits/is_pod.hpp"
@@ -85,6 +87,8 @@
 
 // streaming support
 //
+#if !defined(BOOST_NO_IOSTREAM)
+
 BOOST_TEMPLATED_STREAM_TEMPLATE(E,T)
 inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
       BOOST_TEMPLATED_STREAM(ostream, E,T)& out
@@ -95,6 +99,8 @@
     return out;
 }
 
+#endif // BOOST_NO_IOSTREAM
+
 } // namespace boost
 
 #endif // BOOST_BLANK_HPP
Modified: branches/release/boost/variant/variant.hpp
==============================================================================
--- branches/release/boost/variant/variant.hpp	(original)
+++ branches/release/boost/variant/variant.hpp	2009-06-27 03:34:42 EDT (Sat, 27 Jun 2009)
@@ -15,7 +15,10 @@
 
 #include <cstddef> // for std::size_t
 #include <new> // for placement new
+
+#if !defined(BOOST_NO_TYPEID)
 #include <typeinfo> // for typeid, std::type_info
+#endif // BOOST_NO_TYPEID
 
 #include "boost/variant/detail/config.hpp"
 #include "boost/mpl/aux_/config/eti.hpp"
@@ -691,6 +694,9 @@
 //
 // Generic static visitor that performs a typeid on the value it visits.
 //
+
+#if !defined(BOOST_NO_TYPEID)
+
 class reflect
     : public static_visitor<const std::type_info&>
 {
@@ -704,6 +710,8 @@
 
 };
 
+#endif // BOOST_NO_TYPEID
+
 ///////////////////////////////////////////////////////////////////////////////
 // (detail) class comparer
 //
@@ -1627,11 +1635,13 @@
         return false;
     }
 
+#if !defined(BOOST_NO_TYPEID)
     const std::type_info& type() const
     {
         detail::variant::reflect visitor;
         return this->apply_visitor(visitor);
     }
+#endif
 
 public: // prevent comparison with foreign types
 
@@ -1823,6 +1833,9 @@
 } // namespace boost
 
 // implementation additions
+
+#if !defined(BOOST_NO_IOSTREAM)
 #include "boost/variant/detail/variant_io.hpp"
+#endif // BOOST_NO_IOSTREAM
 
 #endif // BOOST_VARIANT_VARIANT_HPP
Modified: branches/release/libs/variant/doc/reference/variant.xml
==============================================================================
--- branches/release/libs/variant/doc/reference/variant.xml	(original)
+++ branches/release/libs/variant/doc/reference/variant.xml	2009-06-27 03:34:42 EDT (Sat, 27 Jun 2009)
@@ -364,6 +364,11 @@
           </returns>
 
           <throws>Will not throw.</throws>
+          
+          <notes>
+            <simpara>Not available when <code>BOOST_NO_TYPEID</code> is
+              defined.</simpara>
+          </notes>
         </method>
 
       </method-group>
@@ -536,6 +541,12 @@
         <simpara>Calls <code>out << x</code>, where <code>x</code> is
           the content of <code>rhs</code>.</simpara>
       </effects>
+      
+      <notes>
+        <simpara>Not available when <code>BOOST_NO_IOSTREAM</code> is
+          defined.</simpara>
+      </notes>
+
     </function>
     
     <class name="make_variant_over">
Modified: branches/release/libs/variant/test/jobs.h
==============================================================================
--- branches/release/libs/variant/test/jobs.h	(original)
+++ branches/release/libs/variant/test/jobs.h	2009-06-27 03:34:42 EDT (Sat, 27 Jun 2009)
@@ -232,29 +232,6 @@
 
 
 
-
-struct held_type_name : boost::static_visitor<std::string>
-{
-   
-   template<typename T>
-   std::string operator()(const T& ) const
-   {
-      ost_ << '[' << typeid(T).name() << ']';
-      return result();
-   }
-
-   std::string result() const
-   {
-      return ost_.str();
-   }
-
-   mutable std::ostringstream ost_;
-
-}; //held_type_name
-
-
-
-
 template<typename T>
 struct spec 
 {
@@ -267,7 +244,9 @@
    const VariantType& cvar = var;
 
    BOOST_CHECK(boost::apply_visitor(total_sizeof(), cvar) == sizeof(S));
+#if !defined(BOOST_NO_TYPEID)
    BOOST_CHECK(cvar.type() == typeid(S));
+#endif
 
    //
    // Check get<>()
@@ -316,7 +295,9 @@
 {
    const VariantType& cvar = var;
 
+#if !defined(BOOST_NO_TYPEID)
    BOOST_CHECK(cvar.type() != typeid(S));
+#endif
 
    //
    // Check get<>()
Modified: branches/release/libs/variant/test/test3.cpp
==============================================================================
--- branches/release/libs/variant/test/test3.cpp	(original)
+++ branches/release/libs/variant/test/test3.cpp	2009-06-27 03:34:42 EDT (Sat, 27 Jun 2009)
@@ -122,7 +122,9 @@
    std::ostringstream e1_str;
    e1_str << e1;
 
+#if !defined(BOOST_NO_TYPEID)
    BOOST_CHECK(e1.type() == typeid(Add));
+#endif
    BOOST_CHECK(e1_str.str() == "(13+((40+2)-(10+4)))");
 
    //Evaluate expression