SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Go to the documentation of this file.
11 #ifndef smtk_common_Visit_h
12 #define smtk_common_Visit_h
14 #include <type_traits>
55 template<
typename Functor>
64 template<
class... Types>
66 enable_if<std::is_same<decltype(std::declval<Functor>()(args...)),
Visit>::value,
Visit>::type
68 return m_functor(std::forward<Types>(args)...);
73 template<
class... Types>
75 enable_if<!std::is_same<decltype(std::declval<Functor>()(args...)),
Visit>::value,
Visit>::type
77 m_functor(std::forward<Types>(args)...);
82 template<
class... Types>
94 #endif // smtk_common_Visit_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
@ Halt
Stop visiting items immediately.
@ All
The visitor was invoked on every item exhaustively.
@ Empty
The were no values to visit.
Visit operator()(Types &&... args) const
The parenthesis operation simply forwards arguments to whichever method above is enabled.
Definition: Visit.h:83
auto invokeVisitor(Types &&... args) const -> typename std::enable_if< std::is_same< decltype(std::declval< Functor >()(args...)), Visit >::value, Visit >::type
For functors that return a Visit enumerant, simply invoke them:
Definition: Visit.h:65
Visit
Return values common to most visitor methods.
Definition: Visit.h:23
@ Continue
Continue to visit items.
auto invokeVisitor(Types &&... args) const -> typename std::enable_if<!std::is_same< decltype(std::declval< Functor >()(args...)), Visit >::value, Visit >::type
For functors that do not return a Visit enumerant (i.e., void), invoke them but always return Visit::...
Definition: Visit.h:74
Visited
Return value for functions/methods that accept visitors.
Definition: Visit.h:35
@ Some
A visitor signaled early termination.
A template for accepting visitors with different return types.
Definition: Visit.h:56