- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
either.hpp
Go to the documentation of this file.
1 #ifndef QI_EITHER_HPP
2 #define QI_EITHER_HPP
3 #pragma once
4 #include <boost/variant.hpp>
5 #include <ka/utility.hpp>
6
7 namespace qi
8 {
10 template<typename A, typename B>
11 using Either = boost::variant<A, B>;
12
18 template<typename T>
19 using VisitorBase = boost::static_visitor<T>;
20
52 template<typename Proc, typename T>
53 auto visit(Proc&& proc, T&& variant)
54 -> decltype(boost::apply_visitor(ka::fwd<Proc>(proc), ka::fwd<T>(variant)))
55 {
56 using ka::fwd;
57 return boost::apply_visitor(fwd<Proc>(proc), fwd<T>(variant));
58 }
59 } // namespace qi
60
61 #endif // QI_EITHER_HPP
62
qi::VisitorBase
boost::static_visitor< T > VisitorBase
Definition: either.hpp:19
qi::visit
auto visit(Proc &&proc, T &&variant) -> decltype(boost::apply_visitor(ka::fwd< Proc >(proc), ka::fwd< T >(variant)))
Definition: either.hpp:53
qi::Either
boost::variant< A, B > Either
Convenient alias to a variant of two types.
Definition: either.hpp:11