Ho il seguente codice (che segue in gran parte il primo esempio qui: http://www.boost.org/doc/libs/1_42_0/libs/multi_index/doc/examples.html)). Per qualche ragione, con solo 10000 inserimenti nel multiindice, occorrono diversi minuti per eseguire il programma. Sto facendo qualcosa di sbagliato o è previsto?Boost multi-index con prestazioni di inserimento lente
struct A
{
int id;
int name;
int age;
A(int id_,int name_,int age_):id(id_),name(name_),age(age_){}
};
/* tags for accessing the corresponding indices*/
struct id{};
struct name{};
struct age{};
typedef multi_index_container<
A,
indexed_by<
ordered_unique<
tag<id>, BOOST_MULTI_INDEX_MEMBER(A,int,id)>,
ordered_non_unique<
tag<name>,BOOST_MULTI_INDEX_MEMBER(A,int,name)>,
ordered_non_unique<
tag<age>, BOOST_MULTI_INDEX_MEMBER(A,int,age)> >
> A_set;
int main()
{
A_set es;
for (int a = 0; a != 10000; a++) {
es.insert(A(a,a+1,a+2));
}
return 0;
}
Imposta la macro NDEBUG? Se lo metto, il codice è velocissimo. – pmr