Skip to content

Commit

Permalink
Fix the last of the SFINAE
Browse files Browse the repository at this point in the history
  • Loading branch information
wichtounet committed Jul 10, 2024
1 parent fb16086 commit b35eba6
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions include/VisitorUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ namespace eddic {
* \param visitable The object to visit.
* \return The result of the visit.
*/
template<typename Visitor, typename Visitable>
inline typename std::enable_if<!std::is_void<typename Visitor::result_type>::value, typename Visitor::result_type>::type
visit(Visitor&& visitor, Visitable& visitable){
template <typename Visitor, typename Visitable>
inline Visitor::result_type visit(Visitor && visitor, Visitable & visitable) {
return boost::apply_visitor(std::forward<Visitor>(visitor), visitable);
}

Expand All @@ -56,34 +55,11 @@ visit(Visitor&& visitor, Visitable& visitable){
* \param visitable The object to visit.
* \return The result of the visit.
*/
template<typename Visitor, typename Visitable>
inline typename std::enable_if<!std::is_void<typename Visitor::result_type>::value, typename Visitor::result_type>::type
visit(Visitor&& visitor, const Visitable& visitable){
template <typename Visitor, typename Visitable>
inline Visitor::result_type visit(Visitor && visitor, const Visitable & visitable) {
return boost::apply_visitor(std::forward<Visitor>(visitor), visitable);
}

/*!
* Apply the visitor to the given object.
* \param visitor The visitor to apply.
* \param visitable The object to visit.
*/
template<typename Visitor, typename Visitable>
inline typename std::enable_if<std::is_void<typename Visitor::result_type>::value, typename Visitor::result_type>::type
visit(Visitor&& visitor, Visitable& visitable){
boost::apply_visitor(std::forward<Visitor>(visitor), visitable);
}

/*!
* Apply the visitor to the given object.
* \param visitor The visitor to apply.
* \param visitable The object to visit.
*/
template<typename Visitor, typename Visitable>
inline typename std::enable_if<std::is_void<typename Visitor::result_type>::value, typename Visitor::result_type>::type
visit(Visitor&& visitor, const Visitable& visitable){
boost::apply_visitor(std::forward<Visitor>(visitor), visitable);
}

/*!
* Apply the visitor to the given object.
* \param visitor The visitor to apply.
Expand Down

0 comments on commit b35eba6

Please sign in to comment.