fix apply_visitor.

This commit is contained in:
manga_osyo 2012-12-19 07:40:29 +09:00
parent 8b80b159c8
commit 16e7ddf0bf
3 changed files with 18 additions and 6 deletions

View file

@ -127,14 +127,14 @@ namespace sprout {
template<int I, typename Tuple, typename Visitor>
static SPROUT_CONSTEXPR typename std::enable_if<
I == sizeof...(Types),
typename Visitor::result_type
typename std::decay<Visitor>::type::result_type
>::type visit(Tuple&& t, Visitor&& v, int which) {
return typename Visitor::result_type();
return typename std::decay<Visitor>::type::result_type();
}
template<int I, typename Tuple, typename Visitor>
static SPROUT_CONSTEXPR typename std::enable_if<
I != sizeof...(Types),
typename Visitor::result_type
typename std::decay<Visitor>::type::result_type
>::type visit(Tuple&& t, Visitor&& v, int which) {
return I == which
? sprout::forward<Visitor>(v)(sprout::tuples::get<I>(sprout::forward<Tuple>(t)))
@ -249,11 +249,11 @@ namespace sprout {
}
// visitation support
template<typename Visitor>
SPROUT_CONSTEXPR typename Visitor::result_type apply_visitor(Visitor&& visitor) const {
SPROUT_CONSTEXPR typename std::decay<Visitor>::type::result_type apply_visitor(Visitor&& visitor) const {
return visit<0>(tuple_, sprout::forward<Visitor>(visitor), which_);
}
template<typename Visitor>
typename Visitor::result_type apply_visitor(Visitor&& visitor) {
typename std::decay<Visitor>::type::result_type apply_visitor(Visitor&& visitor) {
return visit<0>(tuple_, sprout::forward<Visitor>(visitor), which_);
}
};