1 #ifndef __STRINGPOOL_H__INCLUDED__
2 #define __STRINGPOOL_H__INCLUDED__
7 #ifndef INITIAL_STRINGPOOL_SIZE
8 #define INITIAL_STRINGPOOL_SIZE (1<<15)
12 template <
class T,
class RefcounterTraits = vsHashComp< T > >
43 typename ReferenceCounter::iterator _it;
48 if ( _rc && ( _it != _rc->end() ) ) {
49 if ( (_it->second == 0) || ( ( --(_it->second) ) == 0 ) )
57 if ( _rc && ( _it != _rc->end() ) )
100 return ( _rc && ( _it != _rc->end() ) ) ? _it->first : empty_value;
107 _it = _rc->insert( std::pair< T, unsigned int > ( s, 0 ) ).first;
113 operator const T &()
const
144 if ( _rc && (_rc == r._rc) )
148 return get() == r.
get();
158 return get() < r.
get();
168 return !(*
this == r);
172 Reference
get(
const T &s )
174 return Reference( &referenceCounter, s );
179 return Reference( &referenceCounter );
181 friend class PoolType::Reference;
194 inline std::string
operator+(
const std::string &s,
const StringPool::Reference &r )
199 inline std::string
operator+(
const StringPool::Reference &r,
const std::string &s )
204 template <
typename T >
205 inline T&
operator<<( T &stream,
const StringPool::Reference &ref )
207 return stream<<ref.get();
210 template <
typename T >
217 #endif //__STRINGPOOL_H__INCLUDED__