aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-25 00:03:22 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-25 00:34:10 +0100
commit1296fb6d8d6f047379a07d89f025ef3f4035b356 (patch)
tree6ffa0d615dca28e11f7f6c2f6f9abee039526eeb
parent1032ace47d1a062f8532cad762029dbafab0f6a6 (diff)
downloadpaludis-1296fb6d8d6f047379a07d89f025ef3f4035b356.tar.gz
paludis-1296fb6d8d6f047379a07d89f025ef3f4035b356.tar.xz
Allow const visitors
-rw-r--r--paludis/util/simple_visitor.hh18
1 files changed, 17 insertions, 1 deletions
diff --git a/paludis/util/simple_visitor.hh b/paludis/util/simple_visitor.hh
index 38cff95..d458fd5 100644
--- a/paludis/util/simple_visitor.hh
+++ b/paludis/util/simple_visitor.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008 Ciaran McCreesh
+ * Copyright (c) 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -149,12 +149,28 @@ namespace paludis
}
template <typename Result_, typename UnwrappedVisitor_>
+ Result_ accept_returning(const UnwrappedVisitor_ & v, const Result_ & r = Result_())
+ {
+ WrappedNonVoidResultVisitor<VisitableTypeList_, Result_, const UnwrappedVisitor_> vv(v, r);
+ _real_accept(vv);
+ return vv.result;
+ }
+
+ template <typename Result_, typename UnwrappedVisitor_>
Result_ accept_returning(UnwrappedVisitor_ & v, const Result_ & r = Result_()) const
{
WrappedNonVoidResultVisitor<typename MakeTypeListConst<VisitableTypeList_>::Type, Result_, UnwrappedVisitor_> vv(v, r);
_real_accept_const(vv);
return vv.result;
}
+
+ template <typename Result_, typename UnwrappedVisitor_>
+ Result_ accept_returning(const UnwrappedVisitor_ & v, const Result_ & r = Result_()) const
+ {
+ WrappedNonVoidResultVisitor<typename MakeTypeListConst<VisitableTypeList_>::Type, Result_, const UnwrappedVisitor_> vv(v, r);
+ _real_accept_const(vv);
+ return vv.result;
+ }
};
template <typename BaseClass_, typename RealClass_>