[MultiIndex] Visual C++ 10 issue

Are there known problems with MultiIndex on the current VC++ 10 beta?
I'm looking in particular at URL:http://tinyurl.com/39bmudo. The area
around the line VC++ 10 has a problem with (line 276 of
distributed_property_map.hpp, the error is on the &std::pair line) is:
typedef multi_index::multi_index_container<
std::pair

Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594

On Mon, 10 May 2010, Richard Webb wrote:
Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594
It seems like it is. Is the workaround that complicated, though? Is there a way to get some of that factored out to reuse in other Boost libraries? Would putting an explicit cast to ... std::pair::* in the template argument work instead? -- Jeremiah Willcock

Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594
It seems like it is. Is the workaround that complicated, though? Is there a way to get some of that factored out to reuse in other Boost libraries? Would putting an explicit cast to ... std::pair::* in the template argument work instead?
BTW, did anyone try this with VC10 Release (not beta)?

On Mon, 10 May 2010, Igor R wrote:
Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594
It seems like it is. Is the workaround that complicated, though? Is there a way to get some of that factored out to reuse in other Boost libraries? Would putting an explicit cast to ... std::pair::* in the template argument work instead?
BTW, did anyone try this with VC10 Release (not beta)?
The error I posted is from KTC-XP_VC10RTM, which looks like it is the RTM version. Or is the release version updated from the RTM version? -- Jeremiah Willcock

Jeremiah Willcock
BTW, did anyone try this with VC10 Release (not beta)?
The error I posted is from KTC-XP_VC10RTM, which looks like it is the RTM version. Or is the release version updated from the RTM version?
The release version has the same problem as the beta - the workarounds in both property tree and wave have been updated on Trunk to account for it.

On 10/05/2010 18:49, Jeremiah Willcock wrote:
The error I posted is from KTC-XP_VC10RTM, which looks like it is the RTM version. Or is the release version updated from the RTM version?
It is the release version of VS 2010 Pro. KTC -- Only two things are infinite, the Universe and Stupidity. And I'm not quite sure about the former. - Albert Einstein

Jeremiah Willcock escribió:
On Mon, 10 May 2010, Richard Webb wrote:
Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594
It seems like it is. Is the workaround that complicated, though? Is there a way to get some of that factored out to reuse in other Boost libraries? Would putting an explicit cast to ... std::pair::* in the template argument work instead?
Hi Jeremiah, The problem is not a bug with VC++ 10, but a collateral effect of the way std::pair is implemented in the stdlib provided for this compiler --namely, by deriving from an implementation-specific _Pair_base class where the members are actually defined. This reduced test case can help explain the problem: struct base{int x;}; struct derived:base{}; template< class Class, typename Type, Type Class::*PtrToMember
struct member{};
typedef member
ghost_cells_type;
HTH, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

On Tue, 11 May 2010, joaquin@tid.es wrote:
Jeremiah Willcock escribió:
On Mon, 10 May 2010, Richard Webb wrote:
Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594
It seems like it is. Is the workaround that complicated, though? Is there a way to get some of that factored out to reuse in other Boost libraries? Would putting an explicit cast to ... std::pair::* in the template argument work instead?
Hi Jeremiah,
The problem is not a bug with VC++ 10, but a collateral effect of the way std::pair is implemented in the stdlib provided for this compiler --namely, by deriving from an implementation-specific _Pair_base class where the members are actually defined. This reduced test case can help explain the problem:
Could this be viewed as a library issue, then, or is the type of &std::pair::first not considered to be part of the library's interface? It does seem bad that any use of pointers-to-members is fragile to the use of mixins or hidden base classes as part of a class's implementation. (snip)
The workaround applied at https://svn.boost.org/trac/boost/ticket/3594 works, but it's probably overkill (and uses the objectionable member_offset, which is really meant to be used as a last resort for legacy compilers). A nicer workaround consists in providing a user-defined key extractor:
template
class pair_first_extractor { typedef std::pair value_type; public: typedef First result_type;
const result_type& operator()(const value_type& x)const { return x.first; }
result_type& operator()(value_type& x)const { return x.first; } };
typedef multi_index::multi_index_container< std::pair
, multi_index::indexed_by< multi_index::sequenced<>, multi_index::hashed_unique< pair_first_extractor ghost_cells_type;
OK. Should that code (for std::pairs) be part of multi_index anywhere? It would seem like other users would use parts of pairs as keys. Otherwise, can I copy your code into BGL (under the Boost license)? Also, would just a simple cast on the pointer-to-member type work, or are those not allowed in non-type template arguments? -- Jeremiah Willcock

Jeremiah Willcock
On Tue, 11 May 2010, joaquin <at> tid.es wrote:
Jeremiah Willcock escribió:
On Mon, 10 May 2010, Richard Webb wrote:
Sounds like the same problem as https://svn.boost.org/trac/boost/ticket/3594
[...]
Hi Jeremiah,
The problem is not a bug with VC++ 10, but a collateral effect of the way std::pair is implemented in the stdlib provided for this compiler --namely, by deriving from an implementation-specific _Pair_base class where the members are actually defined. This reduced test case can help explain the problem:
Could this be viewed as a library issue, then, or is the type of &std::pair::first not considered to be part of the library's interface? It does seem bad that any use of pointers-to-members is fragile to the use of mixins or hidden base classes as part of a class's implementation.
I'm sure there must be valid reasons for the restrictons posed by 14.3.2/5 but I can't see them. I posted about the issue in comp.std.c++ some years ago alas the response was nearly null: http://tinyurl.com/32cdmk8 I might try posting again.
The workaround applied at https://svn.boost.org/trac/boost/ticket/3594 works, but it's probably overkill (and uses the objectionable member_offset, which is really meant to be used as a last resort for legacy compilers). A nicer workaround consists in providing a user-defined key extractor:
[...]
OK. Should that code (for std::pairs) be part of multi_index anywhere? It would seem like other users would use parts of pairs as keys.
I don't feel comfortable with providing such custom key extractors (where should we finish once we start down this path?) On the other hand, specializing boost::multi_index::member when Class is a std::pair might be a good idea. I'll add it to my "to consider" list.
Otherwise, can I copy your code into BGL (under the Boost license)?
Sure, use it freely. You might want to use the specialization variant in anticipation to Boost.MultiIndex providing this specialization itself in the future.
Also, would just a simple cast on the pointer-to-member type work, or are those not allowed in non-type template arguments?
That wouldn't work, you can't cast that way in that context. But if
you don't mind coupling with VC++ 10 stdlib implementation details
you can just use
boost::multi_index::member<
std::_Pair_base
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (6)
-
Igor R
-
Jeremiah Willcock
-
Joaquin M Lopez Munoz
-
joaquin@tid.es
-
KTC
-
Richard Webb