aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-22 16:30:44 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-11-22 16:29:09 +0000
commit9b99f1736116eb9825b3e547b12ef0891f3888f9 (patch)
treeb6bd0ba1828342ddf84adc39786437bb9adedb96
parent53e3f61901cc3dab388dcd4f2377fe046a1400a1 (diff)
downloadpaludis-9b99f1736116eb9825b3e547b12ef0891f3888f9.tar.gz
paludis-9b99f1736116eb9825b3e547b12ef0891f3888f9.tar.xz
Serialise std::list cleanly
-rw-r--r--paludis/serialise-impl.hh17
1 files changed, 15 insertions, 2 deletions
diff --git a/paludis/serialise-impl.hh b/paludis/serialise-impl.hh
index c8652bb..89baf3d 100644
--- a/paludis/serialise-impl.hh
+++ b/paludis/serialise-impl.hh
@@ -134,6 +134,18 @@ namespace paludis
}
};
+ template <typename T_>
+ struct SerialiserConstIteratorType
+ {
+ typedef typename T_::ConstIterator Type;
+ };
+
+ template <typename T_>
+ struct SerialiserConstIteratorType<std::list<T_> >
+ {
+ typedef typename std::list<T_>::const_iterator Type;
+ };
+
template <
typename T_>
struct SerialiserObjectWriterHandler<true, false, T_>
@@ -142,10 +154,11 @@ namespace paludis
{
s.raw_stream() << "c(";
unsigned n(0);
- for (typename T_::ConstIterator i(t.begin()), i_end(t.end()) ;
+ for (typename SerialiserConstIteratorType<T_>::Type i(t.begin()), i_end(t.end()) ;
i != i_end ; ++i)
{
- typedef typename std::iterator_traits<typename T_::ConstIterator>::value_type ItemValueType;
+ typedef typename std::iterator_traits<
+ typename SerialiserConstIteratorType<T_>::Type>::value_type ItemValueType;
typedef typename std::tr1::remove_reference<ItemValueType>::type ItemType;
s.raw_stream() << ++n << "=";