Ticket #4495: zzz.cpp

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

Workaround

Line 
1/// "minimal" example using dynamic_properties after including dynamic_bitset, forcing operator>> into std, compiles again
2
3#include <boost/shared_ptr.hpp>
4#include <boost/graph/adjacency_list.hpp>
5#include <boost/graph/graphviz.hpp>
6
7/// this is the bad include
8#include <boost/dynamic_bitset.hpp>
9
10typedef boost::shared_ptr<int> my_t;
11
12/// commented out
13//inline std::istream& operator>> (std::istream& is, my_t&) { return is; }
14
15/// we have to force operator>> into namespace std when we include dynamic_bitset!
16namespace std {
17 inline std::istream& operator>> (std::istream& is, my_t&) { return is; }
18}
19
20
21typedef boost::property< boost::graph_name_t, my_t > graph_p;
22typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::directedS,
23 boost::no_property, boost::no_property, graph_p > graph_t;
24
25typedef boost::ref_property_map<graph_t*, my_t> gname_p;
26
27int main()
28{
29 graph_t g(0);
30 boost::dynamic_properties dp;
31 gname_p gname(boost::get_property(g, boost::graph_name));
32 dp.property("name", gname);
33}
34
35// Local Variables:
36// mode: C++
37// End: