From: stephan b. <sg...@us...> - 2004-12-27 22:51:15
|
Update of /cvsroot/pclasses/pclasses2/src/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19841/src/Util Modified Files: SimplePropertyStore.cpp Log Message: Now at least basically works. It is compatible enough with std::map to use the standard s11n map proxies :). Index: SimplePropertyStore.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Util/SimplePropertyStore.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SimplePropertyStore.cpp 27 Dec 2004 22:32:44 -0000 1.1 +++ SimplePropertyStore.cpp 27 Dec 2004 22:51:05 -0000 1.2 @@ -23,11 +23,21 @@ using namespace std; typedef SimplePropertyStore::key_type key_type; typedef SimplePropertyStore::mapped_type mapped_type; - const key_type SimplePropertyStore::operator[] ( const string & key ) const + const mapped_type SimplePropertyStore::operator[] ( const key_type & key ) const { return this->get( key ); } + mapped_type & SimplePropertyStore::operator[] ( const key_type & key ) + { + map_type::iterator iter = m_map.find( key ); + if ( iter == m_map.end() ) + { + return m_map[key] = mapped_type(); + } + return ( *iter ).second; + } + SimplePropertyStore::SimplePropertyStore() { |