vari
Loading...
Searching...
No Matches
vcast.h
1
22#pragma once
23
24#include "uvref.h"
25#include "vref.h"
26
27namespace vari
28{
29
32template < typename R, typename... Ts >
33 requires( std::convertible_to< Ts&, R > && ... )
35{
36 return r.visit( [&]( auto& item ) -> R {
37 return static_cast< R >( item );
38 } );
39}
40
43template < typename R, typename Del, typename... Ts >
44 requires( std::convertible_to< Ts&, R > && ... )
46{
47 return r.visit( [&]( auto& item ) -> R {
48 return static_cast< R >( item );
49 } );
50}
51
52} // namespace vari
A non-nullable pointer to one of the types in Ts...
Definition: vref.h:40
constexpr decltype(auto) visit(Fs &&... fs) const
Calls the appropriate function from the list fs..., based on the type of the current target.
Definition: vref.h:113
MIT License.
Definition: dispatch.h:32
R vcast(vari::_vref< Ts... > const &r)
Applies static cast to R to item currently referenced by vref
Definition: vcast.h:34
A non-nullable owning pointer to one of the types in Ts...
Definition: uvref.h:43
constexpr decltype(auto) visit(Fs &&... f) const
Calls the appropriate function from the list fs..., based on the type of the current target.
Definition: uvref.h:196