#ifndef RAWSTORAGE_H #define RAWSTORAGE_H #include #include template class raw_storage_iterator : public std::iterator { public: raw_storage_iterator& operator =( const T& element ); explicit raw_storage_iterator( Out cur ) : cur_(cur) {} raw_storage_iterator& operator *() { return *this; } raw_storage_iterator& operator ++() { ++cur_; return *this; } raw_storage_iterator operator ++( int ) { raw_storage_iterator tmp( *this ); ++*this; return tmp; } protected: Out cur_; }; template raw_storage_iterator & raw_storage_iterator::operator =( const T &val ) { T *elem = &*cur_; // get a ptr to element new ( elem ) T(val); // placement and copy constructor return *this; } #endif