Boost logo

Boost Users :

From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2005-02-17 05:56:10


Jochen Hammann <jochen.hammann <at> realtech.com> writes:

>
> Hi,
>
> I am using the Boost MultiIndex container in conjunction with the Microsoft
Visual C++ 7.1 compiler.
> I encountered an runtime exception during some tests of my application. I
made the mistake, that I
> tried to construct an index as a separate object instead of using a reference
to the respective index.
>
> The MultiIndex documentation highlights this issue:
>
> "Note that get returns a reference to the index, and not an index object.
Indices cannot be
> constructed as separate objects from the container they belong to, so the
following
>
> // Wrong: we forgot the & after employee_set::nth_index<1>::type
> const employee_set::nth_index<1>::type name_index=es.get<1>();
>
> does not compile, since it is trying to construct the index object
name_index. This is a common
> source of errors in user code."
>
> I could reproduce the exception by using the MultiIndex example basic.cpp
from the Boost 1.32.0
> release. Unfortunately, Microsoft Visual C++ 7.1 compiles the above mentioned
line without an error
> or warning.

Hi Jochen,

In conformant compilers, index constructors are protected and
the error shows at compile time (try with GCC if you have
it handy.) Unfortunately, these constructors have to be made
public on those compilers for which the defect macro
BOOST_NO_MEMBER_TEMPLATE_FRIENDS is set: this includes all of the
MSVC familiy, even the 8.0 version :(

Other than that, have you experienced any difficulty, problem,
do you have any suggestion for improvement? Users' feeback is
much appreciated.

Regards,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net