Listing 6: Prototype factory default policies

template<typename T>
class PFPlainOwnedPointers
{
public:
  typedef T* stored_type;
  typedef T* pointer_type;
  typedef T* cloning_result_type;

  static cloning_result_type Clone(pointer_type p)
  { return p->Clone(); }

  template<typename It>
  static void DestroyProtoTypes(It beg, It end)
  { std::for_each(beg, end, DestroyProtoType()); }

private:
  class DestroyProtoType
  {
  public:
    template<typename Val>
    operator()(Val elem) { delete elem.second; }
  };

};

class PFSingleThreaded
{
public:
  class Lock {
  public:
    Lock(PFSingleThreaded*){}
  };
protected:
  virtual ~PFSingleThreaded() {}    
};
— End of Listing —