From afd10d62ca30f5d8b574e2a7ea1003f208b57281 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Tue, 24 Dec 2013 20:56:34 -0800 Subject: [PATCH] feat(util/list): improve to_list function, it takes an optional tail Signed-off-by: Leonardo de Moura --- src/util/list.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/list.h b/src/util/list.h index b2ee3c7b62..74669a9081 100644 --- a/src/util/list.h +++ b/src/util/list.h @@ -169,8 +169,10 @@ template unsigned length(list const & l) { } /** \brief Return a list containing the elements in the subrange [begin, end). */ -template list::value_type> to_list(It const & begin, It const & end) { - list::value_type> r; +template list::value_type> +to_list(It const & begin, It const & end, + list::value_type> const & ls = list::value_type>()) { + list::value_type> r = ls; auto it = end; while (it != begin) { --it;