X-Git-Url: https://git.llucax.com/z.facultad/75.29/dale.git/blobdiff_plain/83bfc832589de5700f0ea6184b5784c67f7757da..bf1e3e3456ea42ece1162949f9ae28e40e3d1cf4:/src/number.h?ds=sidebyside diff --git a/src/number.h b/src/number.h index c620513..22f2d3b 100644 --- a/src/number.h +++ b/src/number.h @@ -19,8 +19,10 @@ struct number enum sign_type { positive, negative }; typedef typename std::vector< T > chunk_type; typedef typename chunk_type::size_type size_type; - typedef typename chunk_type::iterator iterator; - typedef typename chunk_type::const_iterator const_iterator; + typedef typename chunk_type::iterator iterator; + typedef typename chunk_type::const_iterator const_iterator; + typedef typename chunk_type::reverse_iterator reverse_iterator; + typedef typename chunk_type::const_reverse_iterator const_reverse_iterator; // Constructores (después de construído, el chunk siempre tiene al menos // un elemento). @@ -54,7 +56,12 @@ struct number iterator begin() { return chunk.begin(); } iterator end() { return chunk.end(); } const_iterator begin() const { return chunk.begin(); } - const_iterator end() const { return chunk.end(); } + const_iterator end() const { return chunk.end(); } + reverse_iterator rbegin() { return chunk.rbegin(); } + reverse_iterator rend() { return chunk.rend(); } + const_reverse_iterator rbegin() const { return chunk.rbegin(); } + const_reverse_iterator rend() const { return chunk.rend(); } + private: // Atributos @@ -145,8 +152,8 @@ number< T > operator+ (const number< T >& n1, const number< T >& n2) template < typename T > std::ostream& operator<< (std::ostream& os, const number< T >& n) { - // FIXME sacar una salida bonita en ASCII =) - std::copy(n.begin(), n.end(), std::ostream_iterator< T >(os, " ")); + // FIXME sacar una salida bonita en ASCII =) + std::copy(n.rbegin(), n.rend(), std::ostream_iterator< T >(os, " ")); return os; }