[multi_index] boost/boost/multi_index/detail/index_base.hpp:49: error

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[multi_index] boost/boost/multi_index/detail/index_base.hpp:49: error

Felipe Magno de Almeida
Hi,

I'm having a compiler error with gcc 3.4.4. It compiles cleanly with
VC7.1 and gcc4.1.
I'm using the CVS version of boost.
The code is:

header_decode_type and header_encode_type types dont really matter,
are just member variables that are passed to header constructor.

header headers::operator[](std::string const& name) const // line 57
{
  headers_multi_index_t::nth_index<1>::type const& index =
headers_set_.get<1>();
  return header(index.equal_range(name)
    , header_decode_handler_, header_encode_handler_);
}

The headers_multi_index_t is:

typedef std::pair<std::string, std::string> pair;
typedef mi::multi_index_container<pair
  , mi::indexed_by
    <
      mi::sequenced<>
      , mi::ordered_non_unique
        <
          BOOST_MULTI_INDEX_MEMBER(pair, std::string, first)
          , iless
        >
    >
  > headers_multi_index_t;

And the header constructor is:

typedef std::pair<iterator, iterator> iterator_pair;
header(iterator_pair pair
    , header_decode_type const& header_decode_handler
    , header_encode_type const& header_encode_handler);

The error message is:

../src/headers.cpp: In member function `mail::header
mail::headers::operator[](const std::string&) const':
../../../libs/boost/boost/multi_index/detail/index_base.hpp:49: error:
`typedef struct
boost::multi_index::detail::index_node_base<mail::pair>
boost::multi_index::detail::index_base<mail::pair,
boost::multi_index::indexed_by<boost::multi_index::sequenced<boost::multi_index::tag<mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na> >,
boost::multi_index::ordered_non_unique<boost::multi_index::member<mail::pair,
std::string, &std::pair<std::string, std::string>::first>,
mail::iless, mpl_::na>, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>,
std::allocator<mail::pair> >::node_type' is protected
../src/headers.cpp:61: error: within this context

Any help would be greatly apreaciated,
best regards.
--
Felipe Magno de Almeida

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [multi_index]boost/boost/multi_index/detail/index_base.hpp:49:error

Joaquin M LópezMuñoz
Felipe Magno de Almeida ha escrito:

> Hi,
>
> I'm having a compiler error with gcc 3.4.4. It compiles cleanly with
> VC7.1 and gcc4.1.
> I'm using the CVS version of boost.
> The code is:
>
> header_decode_type and header_encode_type types dont really matter,
> are just member variables that are passed to header constructor.
>
> header headers::operator[](std::string const& name) const // line 57
> {
>   headers_multi_index_t::nth_index<1>::type const& index =
> headers_set_.get<1>();
>   return header(index.equal_range(name)
>     , header_decode_handler_, header_encode_handler_);
> }
>
> The headers_multi_index_t is:
>
> typedef std::pair<std::string, std::string> pair;
> typedef mi::multi_index_container<pair
>   , mi::indexed_by
>     <
>       mi::sequenced<>
>       , mi::ordered_non_unique
>         <
>           BOOST_MULTI_INDEX_MEMBER(pair, std::string, first)
>           , iless
>         >
>     >
>   > headers_multi_index_t;
>
> And the header constructor is:
>
> typedef std::pair<iterator, iterator> iterator_pair;

Here. What is this "iterator" type? What index.equal_range(name)
returns is a

  std::pair<
    headers_multi_index_t::nth_index<1>::type::iterator,
    headers_multi_index_t::nth_index<1>::type::iterator
  >

where the iterators are not the same type as
headers_multi_index_t::iterator; this is explained with more parsimony at

http://boost-consulting.com/boost/libs/multi_index/doc/tutorial/basics.html#iterator_access

Could this be related to the problem, or am I completely misguided?
If the latter, a complete testcase reproducing the problem would be of
much help.

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [multi_index]boost/boost/multi_index/detail/index_base.hpp:49:error

Felipe Magno de Almeida
On 3/6/06, Joaquín Mª López Muñoz <[hidden email]> wrote:

[snip]

> >
> > typedef std::pair<iterator, iterator> iterator_pair;
>
> Here. What is this "iterator" type? What index.equal_range(name)
> returns is a

typedef headers_multi_index_t::nth_index<1>::type::iterator iterator;

>
>   std::pair<
>     headers_multi_index_t::nth_index<1>::type::iterator,
>     headers_multi_index_t::nth_index<1>::type::iterator
>   >

Well, looks like it s right then...

>
> where the iterators are not the same type as
> headers_multi_index_t::iterator; this is explained with more parsimony at

Yes, I thought so... But looks like I'm using it right...
It compiles cleanly in VC7.1 and gcc 4.1

>
> http://boost-consulting.com/boost/libs/multi_index/doc/tutorial/basics.html#iterator_access
>
> Could this be related to the problem, or am I completely misguided?
> If the latter, a complete testcase reproducing the problem would be of
> much help.

Looks like that's not the problem

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

--
Felipe Magno de Almeida

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [multi_index]boost/boost/multi_index/detail/index_base.hpp:49:error

Joaquin M LópezMuñoz
In reply to this post by Joaquin M LópezMuñoz
----- Mensaje original -----
De: Felipe Magno de Almeida <[hidden email]>
Fecha: Martes, Marzo 7, 2006 6:34 pm
Asunto: Re: [boost][multi_index]
boost/boost/multi_index/detail/index_base.hpp:49:error

> On 3/6/06, Joaquín Mª López Muñoz <[hidden email]> wrote:
>
> [snip]
>
> > >
> > > typedef std::pair<iterator, iterator> iterator_pair;
> >
> > Here. What is this "iterator" type? What index.equal_range(name)
> > returns is a
>
> typedef headers_multi_index_t::nth_index<1>::type::iterator iterator;

[...]

> Looks like that's not the problem
>

Yep, looks like this is OK, and, as you say, the thing
works on other compilers.
The following is a shot in the dark. Can replace your

typedef headers_multi_index_t::nth_index<1>::type::iterator iterator;

with something like

typedef headers_multi_index_t::nth_index<1>::type::iterator
  my_iterator; // note, name changed

adjust the dependent typedefs and try to compile? Older
versions of GCC have sometimes clashing symbol problems
with symbols that ought not to clash. Additionally, I'd
check the using decls and directives in effect.

If this does not shed any light, it'd be extremely
helpful if you can isolate the problem into a complete
testcase you can post or send to me. I've tried myself
to reproduce the issue following your general code outline,
but didn't get the compiler to choke as you have reported.

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [multi_index]boost/boost/multi_index/detail/index_base.hpp:49:error

Felipe Magno de Almeida
On 3/7/06, JOAQUIN LOPEZ MU?Z <[hidden email]> wrote:

> ----- Mensaje original -----
> De: Felipe Magno de Almeida <[hidden email]>
> Fecha: Martes, Marzo 7, 2006 6:34 pm
> Asunto: Re: [boost][multi_index]
> boost/boost/multi_index/detail/index_base.hpp:49:error
>
> > On 3/6/06, Joaquín Mª López Muñoz <[hidden email]> wrote:
> >
> > [snip]
> >
> > > >
> > > > typedef std::pair<iterator, iterator> iterator_pair;
> > >
> > > Here. What is this "iterator" type? What index.equal_range(name)
> > > returns is a
> >
> > typedef headers_multi_index_t::nth_index<1>::type::iterator iterator;
>
> [...]
>
> > Looks like that's not the problem
> >
>
> Yep, looks like this is OK, and, as you say, the thing
> works on other compilers.
> The following is a shot in the dark. Can replace your
>
> typedef headers_multi_index_t::nth_index<1>::type::iterator iterator;
>
> with something like
>
> typedef headers_multi_index_t::nth_index<1>::type::iterator
>   my_iterator; // note, name changed
>
> adjust the dependent typedefs and try to compile? Older
> versions of GCC have sometimes clashing symbol problems
> with symbols that ought not to clash. Additionally, I'd
> check the using decls and directives in effect.
>
> If this does not shed any light, it'd be extremely
> helpful if you can isolate the problem into a complete
> testcase you can post or send to me. I've tried myself
> to reproduce the issue following your general code outline,
> but didn't get the compiler to choke as you have reported.
changing to my_iterator didnt worked too...
So created a case smaller case where it fails to compile (now on
gcc-4.1 and gcc-3.4.4).
I'm sending you the error message and the source file.
It compiles cleanly on VC7.1.
The gcc seems to complain that equal_range in ordered_index isnt
acessible, which doesnt seem to be the case...

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

Thank you very much for your help.
--
Felipe Magno de Almeida

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

test.cpp (1K) Download Attachment
test.log (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [multi_index]boost/boost/multi_index/detail/index_base.hpp:49:error

Joaquin M LópezMuñoz


Felipe Magno de Almeida ha escrito:
[...]

> changing to my_iterator didnt worked too...
> So created a case smaller case where it fails to compile (now on
> gcc-4.1 and gcc-3.4.4).
> I'm sending you the error message and the source file.
> It compiles cleanly on VC7.1.
> The gcc seems to complain that equal_range in ordered_index isnt
> acessible, which doesnt seem to be the case...
>

Hello Felipe,

In this case the problem is with the expression

c.equal_range("lala")

which should be

index.equal_range("lala")

The corrected version I'm sending you attached works fine here
(GCC 3.2). The fact that your version compiled fine in VC 7.1 is
a side effect of workarounds related to the defect signalled by the
macro BOOST_NO_MEMBER_TEMPLATE_FRIENDS (see
docs of Boost.Config on  this macro.)

I'm afraid this is not related to your original problem,
so I stay tuned for further feedback from you.

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

felipetest.cpp (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [multi_index]boost/boost/multi_index/detail/index_base.hpp:49:error

Felipe Magno de Almeida
On 3/8/06, Joaquín Mª López Muñoz <[hidden email]> wrote:
>

[snip]

>
> Hello Felipe,

Hello Joaquin,

>
> In this case the problem is with the expression
>
> c.equal_range("lala")
>
> which should be
>
> index.equal_range("lala")

I see.

> The corrected version I'm sending you attached works fine here
> (GCC 3.2). The fact that your version compiled fine in VC 7.1 is
> a side effect of workarounds related to the defect signalled by the
> macro BOOST_NO_MEMBER_TEMPLATE_FRIENDS (see
> docs of Boost.Config on  this macro.)

Wroked here too now.

>
> I'm afraid this is not related to your original problem,
> so I stay tuned for further feedback from you.

I found a workaround.
Creating a local pair of the iterators and then passing it to the
constructor makes the gcc 3.4.4 accept it.
I think it is enough to me.

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

Thanks for all your time on this issue.
--
Felipe Magno de Almeida

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost