1

I am trying to use multi_index_container with templates. below is my code.

template < class ValueType >
class anrQueue
{
private:
    typedef boost::multi_index_container<
    ValueType,
    indexed_by<
    sequenced<>,
    ordered_unique<identity<ValueType> >
    >
    > a_queue;

a_queue mQueue;

public:
size_t remove(const ValueType& x) {
    return mQueue.get<1>().erase(x);
}
-------------------------^
error: expected primary-expression before ‘)’ token

How to resolve this

1 Answers1

0

Write:

return mQueue.template get<1>().erase(x);

Look here for an explanation on the usage of template on dependent contexts.

Joaquín M López Muñoz
  • 5,243
  • 1
  • 15
  • 20