Ticket #4495: yyy.cpp

File yyy.cpp, 6.4 KB (added by Thomas Krennwallner <tkren@…>, 12 years ago)

Nonworking example with dynamic_bitset

Line 
1/// "minimal" example using dynamic_properties after including dynamic_bitset, does not compile
2
3#include <boost/shared_ptr.hpp>
4#include <boost/graph/adjacency_list.hpp>
5#include <boost/graph/graphviz.hpp>
6
7/// including dynamic_bitset.hpp breaks operator>>, we get the following error:
8///
9/// $ g++ -W -Wall -I/opt/local/include yyy.cpp
10/// /opt/local/include/boost/lexical_cast.hpp: In member function 'bool boost::detail::lexical_stream_limited_src<CharT, Base, Traits>::operator>>(InputStreamable&) [with InputStreamable = boost::shared_ptr<int>, CharT = char, Base = std::basic_streambuf<char, std::char_traits<char> >, Traits = std::char_traits<char>]':
11/// /opt/local/include/boost/lexical_cast.hpp:1151: instantiated from 'Target boost::detail::lexical_cast(typename boost::call_traits<T2>::param_type, CharT*, size_t) [with Target = boost::shared_ptr<int>, Source = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool Unlimited = false, CharT = char]'
12/// /opt/local/include/boost/lexical_cast.hpp:1174: instantiated from 'Target boost::lexical_cast(const Source&) [with Target = boost::shared_ptr<int>, Source = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]'
13/// /opt/local/include/boost/property_map/dynamic_property_map.hpp:44: instantiated from 'Value boost::detail::read_value(const std::string&) [with Value = boost::shared_ptr<int>]'
14/// /opt/local/include/boost/property_map/dynamic_property_map.hpp:162: instantiated from 'void boost::detail::dynamic_property_map_adaptor<PropertyMap>::do_put(const boost::any&, const boost::any&, mpl_::bool_<true>) [with PropertyMap = boost::ref_property_map<graph_t*, boost::shared_ptr<int> >]'
15/// /opt/local/include/boost/property_map/dynamic_property_map.hpp:205: instantiated from 'void boost::detail::dynamic_property_map_adaptor<PropertyMap>::put(const boost::any&, const boost::any&) [with PropertyMap = boost::ref_property_map<graph_t*, boost::shared_ptr<int> >]'
16/// yyy.cpp:50: instantiated from here
17/// /opt/local/include/boost/lexical_cast.hpp:785: error: no match for 'operator>>' in 'stream >> output'
18/// /usr/include/c++/4.2.1/istream:131: note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>& (*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
19/// /usr/include/c++/4.2.1/istream:135: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
20/// /usr/include/c++/4.2.1/istream:142: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]
21/// /usr/include/c++/4.2.1/istream:178: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char, _Traits = std::char_traits<char>]
22/// /usr/include/c++/4.2.1/istream:182: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char, _Traits = std::char_traits<char>]
23/// /usr/include/c++/4.2.1/istream:185: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]
24/// /usr/include/c++/4.2.1/istream:189: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char, _Traits = std::char_traits<char>]
25/// /usr/include/c++/4.2.1/istream:192: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]
26/// /usr/include/c++/4.2.1/istream:196: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char, _Traits = std::char_traits<char>]
27/// /usr/include/c++/4.2.1/istream:200: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]
28/// /usr/include/c++/4.2.1/istream:205: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char, _Traits = std::char_traits<char>]
29/// /usr/include/c++/4.2.1/istream:209: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char, _Traits = std::char_traits<char>]
30/// /usr/include/c++/4.2.1/istream:214: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char, _Traits = std::char_traits<char>]
31/// /usr/include/c++/4.2.1/istream:218: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char, _Traits = std::char_traits<char>]
32/// /usr/include/c++/4.2.1/istream:222: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char, _Traits = std::char_traits<char>]
33/// /usr/include/c++/4.2.1/istream:226: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char, _Traits = std::char_traits<char>]
34/// /usr/include/c++/4.2.1/istream:250: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>]
35#include <boost/dynamic_bitset.hpp>
36
37typedef boost::shared_ptr<int> my_t;
38
39inline std::istream& operator>> (std::istream& is, my_t&) { return is; }
40
41typedef boost::property< boost::graph_name_t, my_t > graph_p;
42typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS,
43 boost::no_property, boost::no_property, graph_p > graph_t;
44
45typedef boost::ref_property_map<graph_t*, my_t> gname_p;
46
47int main()
48{
49 graph_t g(0);
50 boost::dynamic_properties dp;
51 gname_p gname(boost::get_property(g, boost::graph_name));
52 dp.property("name", gname);
53}
54
55// Local Variables:
56// mode: C++
57// End: