[omniORB] list<A::B_ptr> theList; theList.insert( aBObject ) NOPE! but why?

Rob van der Leek r.vd.leek@fokkerspace.nl
Fri, 15 Dec 2000 10:11:21 +0100


I assume you are using the STL container classes... The STL list insert
method has the following signature:
iterator insert(iterator pos, const T& x);
This is not matched by your method call. If you don't want an explicit
position for the object you are inserting use
theList.push_back(aBObject) // add to end of list; or
theList.push_front(aBObject) // add to front of list;

Please note that this is not an omniORB related question.

HTH,
Rob van der Leek

"ERIKSSON,TOBIAS (A-Sweden,ex1)" wrote:
> 
> Hi
>  I'm struggling with the following
> 
> class C
> ...
> void add( A::B_ptr aBObject );
> ...
> private:
>  list<A::B_ptr> theList;
> ...
> };
> 
> void C::add( A::B_ptr aBObject )
> {
>   theList.insert( aBObject );
> }
> 
> But, this does not work, it complains and says that the list<A::B_ptr> does
> not have a method with that argument. Below is the compiler error, what am I
> doing wrong here?
> 
>  Regards
>    Tobias
> 
> g++ -c -g -I. -I/home/tobias/CORBA/omni/include -D__OMNIORB3__
> -D_REENTRANT -I. -D__x86__ -D__linux__ -D__OSVERSION__=2
> InterestedParties.cc -o InterestedParties.o
> InterestedParties.cc: In method `void
> InterestedParties::attach(Monitor::_objref_MonitorClient *)':
> InterestedParties.cc:32: no matching function for call to
> `list<Monitor::_objref_MonitorClient
> *,allocator<Monitor::_objref_MonitorClient *> >::insert
> (Monitor::_objref_MonitorClient *&)'
> /usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3/stl_list.h:343:
> candidates are: struct _List_iterator<Monitor::_objref_MonitorClient
> *,Monitor::_objref_MonitorClient *&,Monitor::_objref_MonitorClient **>
> list<Monitor::_objref_MonitorClient
> *,allocator<Monitor::_objref_MonitorClient *>
> >::insert(_List_iterator<Monitor::_objref_MonitorClient
> *,Monitor::_objref_MonitorClient *&,Monitor::_objref_MonitorClient **>,
> Monitor::_objref_MonitorClient *const &)
> /usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3/stl_list.h:351:
> struct _List_iterator<Monitor::_objref_MonitorClient
> *,Monitor::_objref_MonitorClient *&,Monitor::_objref_MonitorClient **>
> list<Monitor::_objref_MonitorClient
> *,allocator<Monitor::_objref_MonitorClient *>
> >::insert(_List_iterator<Monitor::_objref_MonitorClient
> *,Monitor::_objref_MonitorClient *&,Monitor::_objref_MonitorClient **>)
> /usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3/stl_list.h:587:
> void list<Monitor::_objref_MonitorClient
> *,allocator<Monitor::_objref_MonitorClient *>
> >::insert(_List_iterator<Monitor::_objref_MonitorClient
> *,Monitor::_objref_MonitorClient *&,Monitor::_objref_MonitorClient **>,
> unsigned int, Monitor::_objref_MonitorClient *const &)
> make: *** [InterestedParties.o] Error 1