Celeritas 0.6.0-dev.115+3b60a5fd
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::ContainerVisitor< T, U > Class Template Reference

Visit a container's element by calling "visit" on the corresponding index. More...

#include <VariantUtils.hh>

Public Types

Type aliases
using index_type = U
 

Public Member Functions

 ContainerVisitor (T &&container)
 Construct with a container.
 
template<class F >
decltype(autooperator() (F &&func, U const &idx) const
 Visit the functor upon the value at the given index.
 

Detailed Description

template<class T, class U = typename std::remove_reference_t<T>::size_type>
class celeritas::ContainerVisitor< T, U >

Visit a container's element by calling "visit" on the corresponding index.

example:

std::vector<std::variant<int, std:string>> myvec{"hi", 123, "bye"};
ContainerVisitor visit_element{myvec};
visit_element([](auto&& v) { cout << v; }, 1); // Prints '123'
visit_element([](auto&& v) { cout << v; }, 2); // Prints 'bye'
Visit a container's element by calling "visit" on the corresponding index.
Definition VariantUtils.hh:87

The documentation for this class was generated from the following file: