Ticket #3051: variant.patch
File variant.patch, 5.0 KB (added by , 13 years ago) |
---|
-
boost/blank.hpp
15 15 16 16 #include "boost/blank_fwd.hpp" 17 17 18 #if !defined(BOOST_NO_IOSTREAM) 18 19 #include <iosfwd> // for std::basic_ostream forward declare 20 #include "boost/detail/templated_streams.hpp" 21 #endif // BOOST_NO_IOSTREAM 19 22 20 #include "boost/detail/templated_streams.hpp"21 23 #include "boost/mpl/bool.hpp" 22 24 #include "boost/type_traits/is_empty.hpp" 23 25 #include "boost/type_traits/is_pod.hpp" … … 85 87 86 88 // streaming support 87 89 // 90 #if !defined(BOOST_NO_IOSTREAM) 91 88 92 BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) 89 93 inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<( 90 94 BOOST_TEMPLATED_STREAM(ostream, E,T)& out … … 95 99 return out; 96 100 } 97 101 102 #endif // BOOST_NO_IOSTREAM 103 98 104 } // namespace boost 99 105 100 106 #endif // BOOST_BLANK_HPP -
boost/variant/variant.hpp
15 15 16 16 #include <cstddef> // for std::size_t 17 17 #include <new> // for placement new 18 19 #if !defined(BOOST_NO_TYPEID) 18 20 #include <typeinfo> // for typeid, std::type_info 21 #endif // BOOST_NO_TYPEID 19 22 20 23 #include "boost/variant/detail/config.hpp" 21 24 #include "boost/mpl/aux_/config/eti.hpp" … … 691 694 // 692 695 // Generic static visitor that performs a typeid on the value it visits. 693 696 // 697 698 #if !defined(BOOST_NO_TYPEID) 699 694 700 class reflect 695 701 : public static_visitor<const std::type_info&> 696 702 { … … 704 710 705 711 }; 706 712 713 #endif // BOOST_NO_TYPEID 714 707 715 /////////////////////////////////////////////////////////////////////////////// 708 716 // (detail) class comparer 709 717 // … … 1627 1635 return false; 1628 1636 } 1629 1637 1638 #if !defined(BOOST_NO_TYPEID) 1630 1639 const std::type_info& type() const 1631 1640 { 1632 1641 detail::variant::reflect visitor; 1633 1642 return this->apply_visitor(visitor); 1634 1643 } 1644 #endif 1635 1645 1636 1646 public: // prevent comparison with foreign types 1637 1647 … … 1823 1833 } // namespace boost 1824 1834 1825 1835 // implementation additions 1836 1837 #if !defined(BOOST_NO_IOSTREAM) 1826 1838 #include "boost/variant/detail/variant_io.hpp" 1839 #endif // BOOST_NO_IOSTREAM 1827 1840 1828 1841 #endif // BOOST_VARIANT_VARIANT_HPP -
libs/variant/test/jobs.h
232 232 233 233 234 234 235 // This is not used and breaks when BOOST_NO_TYPEID is defined 236 //struct held_type_name : boost::static_visitor<std::string> 237 //{ 238 // 239 // template<typename T> 240 // std::string operator()(const T& ) const 241 // { 242 // ost_ << '[' << typeid(T).name() << ']'; 243 // return result(); 244 // } 245 // 246 // std::string result() const 247 // { 248 // return ost_.str(); 249 // } 250 // 251 // mutable std::ostringstream ost_; 252 // 253 //}; //held_type_name 235 254 236 struct held_type_name : boost::static_visitor<std::string>237 {238 239 template<typename T>240 std::string operator()(const T& ) const241 {242 ost_ << '[' << typeid(T).name() << ']';243 return result();244 }245 255 246 std::string result() const247 {248 return ost_.str();249 }250 256 251 mutable std::ostringstream ost_;252 253 }; //held_type_name254 255 256 257 258 257 template<typename T> 259 258 struct spec 260 259 { … … 267 266 const VariantType& cvar = var; 268 267 269 268 BOOST_CHECK(boost::apply_visitor(total_sizeof(), cvar) == sizeof(S)); 269 #if !defined(BOOST_NO_TYPEID) 270 270 BOOST_CHECK(cvar.type() == typeid(S)); 271 #endif 271 272 272 273 // 273 274 // Check get<>() … … 316 317 { 317 318 const VariantType& cvar = var; 318 319 320 #if !defined(BOOST_NO_TYPEID) 319 321 BOOST_CHECK(cvar.type() != typeid(S)); 322 #endif 320 323 321 324 // 322 325 // Check get<>() -
libs/variant/test/test3.cpp
122 122 std::ostringstream e1_str; 123 123 e1_str << e1; 124 124 125 #if !defined(BOOST_NO_TYPEID) 125 126 BOOST_CHECK(e1.type() == typeid(Add)); 127 #endif 126 128 BOOST_CHECK(e1_str.str() == "(13+((40+2)-(10+4)))"); 127 129 128 130 //Evaluate expression -
libs/variant/doc/reference/variant.xml
364 364 </returns> 365 365 366 366 <throws>Will not throw.</throws> 367 368 <notes> 369 <simpara>Not available when <code>BOOST_NO_TYPEID</code> is 370 defined.</simpara> 371 </notes> 367 372 </method> 368 373 369 374 </method-group> … … 536 541 <simpara>Calls <code>out << x</code>, where <code>x</code> is 537 542 the content of <code>rhs</code>.</simpara> 538 543 </effects> 544 545 <notes> 546 <simpara>Not available when <code>BOOST_NO_IOSTREAM</code> is 547 defined.</simpara> 548 </notes> 549 539 550 </function> 540 551 541 552 <class name="make_variant_over">