[MultiIndex] cryptic gcc error

Hello *, I try to use a multi_index container with a composite key. The container is defined as follows: struct index_data { entry_header header; //has various public fields one of them is timestamp_ fs::entry entry; bool masked; }; typedef size_t timestamp_t; //in reallity this type is a class, but the error can be reproduced with this typedef as well timestamp_t const& timestamp(index_data const& data) { return data.header.timestamp_; } bool mask_state(index_data const& data) { return data.masked; } struct entry_data_tag {}; typedef mi::multi_index_container < index_data, mi::indexed_by < mi::ordered_non_unique < mi::tag<entry_data_tag> , mi::composite_key < mi::global_fun<index_data const&, bool, &mask_state> //this could be a direct member reference, but I intially used fusion::map and reduced the problem to minimum , mi::global_fun<index_data const&, timestamp_t const&, ×tamp> > > >
entry_index;
typedef entry_index::index<entry_data_tag>::type entry_data; void mask_all() { using namespace boost::lambda; entry_data& entries = pimpl_->indexed; entries.find(boost::make_tuple(false)); //!!!! this line results in an error novel by gcc 4.3 } The error description is: multi_index/composite_key.hpp:638: error: no match for 'operator*' in '*x' Does anyone have some suggestions why that happens? With Kind Regards, Ovanes

On Fri, Sep 2, 2011 at 8:07 AM, Ovanes Markarian <om_boost@keywallet.com> wrote:
entries.find(boost::make_tuple(false)); //!!!! this line results in an
Your composite_key has two components, so shouldn't you make a 2-tuple with a timestamp instead of just providing the mask state? --DD

On Fri, Sep 2, 2011 at 3:32 PM, Dominique Devienne <ddevienne@gmail.com>wrote:
On Fri, Sep 2, 2011 at 8:07 AM, Ovanes Markarian <om_boost@keywallet.com> wrote:
entries.find(boost::make_tuple(false)); //!!!! this line results in
an
Your composite_key has two components, so shouldn't you make a 2-tuple with a timestamp instead of just providing the mask state? --DD
Hello Dominique,
as far as I understand docs I souldn't. And that is also the reason why I use a multi_index here with a composite key... This is what I assume from the examples in the docs: http://www.boost.org/doc/libs/1_46_1/libs/multi_index/doc/tutorial/key_extra... With Kind Regards, Ovanes

Ok, sorry for the noise... composite_key expects the result_type as the first parameter and I did not specify it... Anyway thanks to all answers! On Fri, Sep 2, 2011 at 3:07 PM, Ovanes Markarian <om_boost@keywallet.com>wrote:
Hello *,
I try to use a multi_index container with a composite key. The container is defined as follows:
struct index_data { entry_header header; //has various public fields one of them is timestamp_ fs::entry entry; bool masked; };
typedef size_t timestamp_t; //in reallity this type is a class, but the error can be reproduced with this typedef as well
timestamp_t const& timestamp(index_data const& data) { return data.header.timestamp_; }
bool mask_state(index_data const& data) { return data.masked; }
struct entry_data_tag {};
typedef mi::multi_index_container < index_data, mi::indexed_by < mi::ordered_non_unique < mi::tag<entry_data_tag> , mi::composite_key < mi::global_fun<index_data const&, bool, &mask_state> //this could be a direct member reference, but I intially used fusion::map and reduced the problem to minimum , mi::global_fun<index_data const&, timestamp_t const&, ×tamp> > > >
entry_index;
typedef entry_index::index<entry_data_tag>::type entry_data;
void mask_all() { using namespace boost::lambda; entry_data& entries = pimpl_->indexed;
entries.find(boost::make_tuple(false)); //!!!! this line results in an error novel by gcc 4.3 }
The error description is: multi_index/composite_key.hpp:638: error: no match for 'operator*' in '*x'
Does anyone have some suggestions why that happens?
With Kind Regards, Ovanes
participants (2)
-
Dominique Devienne
-
Ovanes Markarian