#ifndef INCLUDED_PLAINALLOC_H_ #define INCLUDED_PLAINALLOC_H_ #include template class PlainAlloc: public std::allocator { template friend std::ostream &operator<<(std::ostream &out, PlainAlloc const &alloc); Data d_data; public: PlainAlloc(); PlainAlloc(Data data); PlainAlloc(PlainAlloc const &other); operator Data &(); PlainAlloc &operator=(Data const &data); }; template PlainAlloc::PlainAlloc() {} template PlainAlloc::PlainAlloc(Data data) : d_data(data) {} template PlainAlloc::PlainAlloc(PlainAlloc const &other) : d_data(other.d_data) {} template PlainAlloc::operator Data &() { return d_data; } template PlainAlloc &PlainAlloc::operator=(Data const &data) { d_data = data; } template inline std::ostream &operator<<(std::ostream &out, PlainAlloc const &alloc) { return out << alloc.d_data; } #endif