Dear all,
 
First, may I blaspheme by invoking Java. In Java, a pool of strings, initially empty, is maintained privately by the class String. This is essentially a case of the Flyweight design pattern (http://en.wikipedia.org/wiki/Flyweight_pattern) where memory usage is minimised by sharing as much data as possible with other similar objects. Thus if we have two different instances of a string "foo" we shall reuse a single area of memory. In Java there is a concept of string internisation:
 
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#intern%28%29
 
My question is, what is the best way to implement this in C++? Is the answer to this a combination of std::string and boost::fast_pool_allocator, as discussed here:
 
http://www.gamedev.net/community/forums/topic.asp?topic_id=534428
 
Or are there better ways? Perhaps there is something like an intern_string? What would be the best practice where memory usage is an issue?
 
Many thanks,
Paul