This is a follow-up to my question on unintrusive wrapper classes for std::vector (Unintrusive way to enforce size constraint on std::vector?).
I am trying to make my wrapper class look and feel just like an std::vector
, with some additional built in functionality. Towards this end, I am trying to add all public member functions provided by std::vector
, simply forwarding them to the private vector stored within my class. However I am struggling with these typedefs:
typedef Allocator allocator_type;
typedef std::allocator_traits<Allocator>::pointer pointer;
typedef std::allocator_traits<Allocator>::const_pointer const_pointer;
typedef RandomAccessIterator iterator;
typedef std::const_iterator const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef const_reverse_iterator std::reverse_iterator<iterator>;
The above are producing the following errors:
‘Allocator’ does not name a type
typedef Allocator allocator_type;
^
error: ‘RandomAccessIterator’ does not name a type
typedef RandomAccessIterator iterator;
Is there an #include
statement I am likely missing? Or is it my responsibility to also define RandomAccessIterator
and Allocator
in some way, and if so, how? All I want to do is 'forward' calls to the class member vector so I am looking to implement the full vector interface as simply as possible.
Aucun commentaire:
Enregistrer un commentaire