Topic: newbie STL/AIX C++ question
Author: hbarta@psycfrnd.interaccess.com (Henry Barta)
Date: 1995/06/01 Raw View
I'm trying to compile the following code on AIX using V2.1.4 of the IBM
C++ compiler:
#include <algo.h>
#include <function.h>
#include <iterator.h>
#include <map.h>
#include <pair.h>
class A // Quick and Dirty class so we have something to map
{
public:
void* k;
A(void* p): k(p)
{;}
A( const A& r )
{ k=r.k; }
A& operator=(const A& r )
{ k=r.k; return *this; }
A(){}
~A(){}
operator==( const A& r ) const
{ return r.k == k; }
};
void* const& key( A const& r)
{ return r.k;}
map<void*, A, less<void*> > m;
-----------
Compiling the code results in the following diagnostic:
"/v/XCB/XCB_INC/stl/tree.h", line 56.12: 1540-222: (S) \
"rb_tree<void*,pair<void*const,A>,select1st<pair<void*const,A>,void*>,less<void*> >::rb_tree_node" \
needs a constructor because class member "value_field" needs a constructor initializer.
"stl-map.C", line 25.1: 1540-207: (I) \
The previous message applies to the definition of template \
"map<void*,A,less<void*> >".
Unfortunately, I'm mot sufficiently knowledgeable about C++ to
determine the exact problem, but I would like to know if I'm doing
something wrong or if this is an area where the compiler has problems
with templates. Is there anything that can be done to resolve this
problem?
Thanks in advance,
hank
--
Hank Barta White Oak Software Inc.
hbarta@interaccess.com Predictable Systems by Design.
Beautiful Sunny Winfield, Illinois