feat(util/list): add to_list from buffer

This commit is contained in:
Leonardo de Moura 2014-12-16 18:14:11 -08:00
parent 1797e2846f
commit aedf74e80a

View file

@ -11,6 +11,7 @@ Author: Leonardo de Moura
#include "util/debug.h" #include "util/debug.h"
#include "util/optional.h" #include "util/optional.h"
#include "util/memory_pool.h" #include "util/memory_pool.h"
#include "util/buffer.h"
namespace lean { namespace lean {
/** /**
@ -200,6 +201,11 @@ to_list(It const & begin, It const & end,
return r; return r;
} }
template<typename T>
list<T> to_list(buffer<T> const & b) {
return to_list(b.begin(), b.end());
}
/** \brief Return <tt>reverse(to_list(begin, end))</tt> */ /** \brief Return <tt>reverse(to_list(begin, end))</tt> */
template<typename It> list<typename std::iterator_traits<It>::value_type> reverse_to_list(It const & begin, It const & end) { template<typename It> list<typename std::iterator_traits<It>::value_type> reverse_to_list(It const & begin, It const & end) {
list<typename std::iterator_traits<It>::value_type> r; list<typename std::iterator_traits<It>::value_type> r;