Listing 4: The prototype factory class with template template parameters (not supported by Microsoft VC++)

// Class CloneFromPointer as in Listing 3
//
template
<
  typename Proto, 
  typename Id,
  template<typename> CloningPolicy = CloneFromPointer
>
class ProtoTypeFactory
{
public:
  void RegisterProtoType(Proto* pProtoType, Id id)
  { protoTypeCollection[id] = pProtoType; }
  
  CloningPolicy<Proto>::cloning_result_type GetClone(Id id)
  { 
    return CloningPolicy<Proto>::Clone(
      protoTypeCollection[id]
      ); 
  }

private:
  std::map<Id, Proto*> protoTypeCollection;
};
— End of Listing —