From e5c81d07022e9e0d8e3a789cd0322303bd14f27a Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Thu, 25 Jan 2001 04:45:52 +0000 Subject: [PATCH] fixed very strange VC++ bug that was showing up in graph/test/graph.cpp Something about the code gen for compressed_pair_1::operator= was going wrong. Writing it explicitly, and playing with some ordering fixed the problem, don't ask my why. [SVN r8765] --- include/boost/detail/ob_compressed_pair.hpp | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/boost/detail/ob_compressed_pair.hpp b/include/boost/detail/ob_compressed_pair.hpp index 7f02a04..16c23d0 100644 --- a/include/boost/detail/ob_compressed_pair.hpp +++ b/include/boost/detail/ob_compressed_pair.hpp @@ -113,6 +113,16 @@ public: compressed_pair_0(const ::boost::compressed_pair& x) : _first(x.first()), _second(x.second()) {} +#if 0 + compressed_pair_0& operator=(const compressed_pair_0& x) { + cout << "assigning compressed pair 0" << endl; + _first = x._first; + _second = x._second; + cout << "finished assigning compressed pair 0" << endl; + return *this; + } +#endif + first_reference first() { return _first; } first_const_reference first() const { return _first; } @@ -145,14 +155,27 @@ public: compressed_pair_1() : T2(), _first() {} compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {} + template explicit compressed_pair_1(const A& val) { init_one::value>::init(val, &_first, static_cast(this)); } + compressed_pair_1(const ::boost::compressed_pair& x) : T2(x.second()), _first(x.first()) {} +#ifdef BOOST_MSVC + // Total weirdness. If the assignment to _first is moved after + // the call to the inherited operator=, then this breaks graph/test/graph.cpp + // by way of iterator_adaptor. + compressed_pair_1& operator=(const compressed_pair_1& x) { + _first = x._first; + T2::operator=(x); + return *this; + } +#endif + first_reference first() { return _first; } first_const_reference first() const { return _first; } @@ -193,6 +216,15 @@ public: compressed_pair_2(const ::boost::compressed_pair& x) : T1(x.first()), _second(x.second()) {} +#if 0 + compressed_pair_2& operator=(const compressed_pair_2& x) { + cout << "assigning compressed pair 2" << endl; + T1::operator=(x); + _second = x._second; + cout << "finished assigning compressed pair 2" << endl; + return *this; + } +#endif first_reference first() { return *this; } first_const_reference first() const { return *this; }