37 template<
class Key,
class T>
41 typedef T mapped_type;
42 typedef std::pair<Key,T> value_type;
43 typedef std::list<value_type> list_t;
44 typedef typename list_t::iterator iterator;
45 typedef typename list_t::const_iterator const_iterator;
54 std::map(
const std::map<Key,T>& map_in ) : list_( map_in.list_ ) {}
57 virtual ~std::map() {}
64 iterator begin() {
return list_.begin(); }
67 const_iterator begin()
const {
return list_.begin(); }
70 iterator end() {
return list_.end(); }
73 const_iterator end()
const {
return list_.end(); }
80 mapped_type& operator[](
const key_type& k )
82 iterator itr = find(k);
83 if(itr != end())
return (*itr).second;
84 list_.push_back( value_type( k, T() ) );
85 return list_.back().second;
97 iterator find(
const key_type& k)
99 for( iterator itr = begin(); itr != end(); ++itr ) {
100 if( (*itr).first == k ) {
112 const_iterator find(
const key_type& k)
const
114 for( const_iterator itr = begin(); itr != end(); ++itr ) {
115 if( (*itr).first == k ) {
122 bool empty()
const {
return list_.empty(); }
137 #endif // TEUCHOS_MAP_H
Teuchos header file which uses auto-configuration information to include necessary C++ headers...