2 // { dg-options "-O1" }
3 // Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
16 NAMES_ITEM(const NAMES_ITEM& item2);
18 NAMES_ITEM(const char* name2);
22 bool operator==(const NAMES_ITEM& n) const;
26 NAMES_ITEM::NAMES_ITEM (const NAMES_ITEM& item2)
28 size_t length=std::strlen(item2.name);
30 name=new char[length+1];
31 std::memcpy(name,item2.name,length+1);
34 NAMES_ITEM::NAMES_ITEM (const char* name2)
36 size_t length=std::strlen(name2);
38 name=new char[length+1];
39 std::memcpy(name,name2,length+1);
42 NAMES_ITEM::~NAMES_ITEM ()
44 if (std::strcmp (name, "one") != 0)
50 bool NAMES_ITEM::operator==(const NAMES_ITEM& n) const
52 return (std::strcmp(name,n.name) == 0);
55 bool operator<(const NAMES_ITEM& n1, const NAMES_ITEM& n2)
57 return (std::strcmp(n1.name,n2.name) < 0);
60 typedef map<NAMES_ITEM,size_t,less<NAMES_ITEM> > lookup_t;
64 NAMES_ITEM item ("one");
69 lookup.insert(pair<NAMES_ITEM,size_t>(item,0));