09/07/30 22:13:59 650NzX62
>>870とかを見るとさらに、
class ImagePool : noncopyable {
typedef shared_ptr<Image> ImageSP;
typedef unordered_map< wstring, ImageSP > ImageHash;
ImageHash ih_;
public:
ImageSP get( wstring name ) {
ImageHash::iterator it = ih_.find(name);
if ( it == ImageHash.end() ) {
it = ( ih_.insert( make_pair( name, ImageSP( new Image(name) ) ) ) ).first;
}
return it->second;
}
void clear() { ih_.clear(); }
};
みたいな感じのも書きたくなるな。パフォーマンスどうなるかはシラネ。