add const
parent
c04383b471
commit
949b2841f4
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.20)
|
||||
include(cmake/color.cmake)
|
||||
set(BLT_VERSION 5.4.14)
|
||||
set(BLT_VERSION 5.4.15)
|
||||
|
||||
set(BLT_TARGET BLT)
|
||||
|
||||
|
|
|
@ -199,13 +199,6 @@ namespace blt
|
|||
return m_variant.valueless_by_exception();
|
||||
}
|
||||
|
||||
template <typename T, std::enable_if_t<std::conjunction_v<std::is_invocable<decltype(&T::operator()), T, Types>...> || std::conjunction_v<
|
||||
std::is_invocable<decltype(&T::operator()), Types>...>, bool> = true>
|
||||
constexpr auto visit(T&& visitor) -> decltype(auto)
|
||||
{
|
||||
return std::visit(std::forward<T>(visitor), m_variant);
|
||||
}
|
||||
|
||||
template <typename... Visitee>
|
||||
static constexpr auto make_visitor(Visitee&&... visitees)
|
||||
{
|
||||
|
@ -269,6 +262,16 @@ namespace blt
|
|||
return std::visit(make_visitor(std::forward<Visitee>(visitees)...), m_variant);
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatic visitor generation
|
||||
* @param visitees user lambdas
|
||||
*/
|
||||
template <typename... Visitee>
|
||||
constexpr auto visit(Visitee&&... visitees) const -> decltype(auto)
|
||||
{
|
||||
return std::visit(make_visitor(std::forward<Visitee>(visitees)...), m_variant);
|
||||
}
|
||||
|
||||
template <typename Default, typename... Visitee>
|
||||
constexpr auto visit_value(Default&& default_value, Visitee&&... visitees) -> decltype(auto)
|
||||
{
|
||||
|
@ -420,6 +423,7 @@ namespace blt
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
value_type m_variant;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue