Function find_or

Summary

#include <toml/get.hpp>

(1) template <typename C, template< typename ... > class M, template< typename ... > class V>
    basic_value< C, M, V > const  & find_or(const basic_value< C, M, V > &v, const key &ky, const basic_value< C, M, V > &opt)

(2) template <typename C, template< typename ... > class M, template< typename ... > class V>
    basic_value< C, M, V > & find_or(basic_value< C, M, V > &v, const toml::key &ky, basic_value< C, M, V > &opt)

(3) template <typename C, template< typename ... > class M, template< typename ... > class V>
    basic_value< C, M, V > find_or(basic_value< C, M, V > &&v, const toml::key &ky, basic_value< C, M, V > &&opt)

(4) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< detail::is_exact_toml_type< T, basic_value< C, M, V > >::value, T > const  & find_or(const basic_value< C, M, V > &v, const key &ky, const T &opt)

(5) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< detail::is_exact_toml_type< T, basic_value< C, M, V > >::value, T > & find_or(basic_value< C, M, V > &v, const toml::key &ky, T &opt)

(6) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< detail::is_exact_toml_type< T, basic_value< C, M, V > >::value, detail::remove_cvref_t< T > > find_or(basic_value< C, M, V > &&v, const toml::key &ky, T &&opt)

(7) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< std::is_same< T, std::string >::value, std::string > const  & find_or(const basic_value< C, M, V > &v, const key &ky, const T &opt)

(8) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< std::is_same< T, std::string >::value, std::string > & find_or(basic_value< C, M, V > &v, const toml::key &ky, T &opt)

(9) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< std::is_same< T, std::string >::value, std::string > find_or(basic_value< C, M, V > &&v, const toml::key &ky, T &&opt)

(10) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
     detail::enable_if_t< detail::is_string_literal< typename std::remove_reference< T >::type >::value, std::string > find_or(const basic_value< C, M, V > &v, const toml::key &ky, T &&opt)

(11) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
     detail::enable_if_t< detail::conjunction< detail::negation< detail::is_exact_toml_type< detail::remove_cvref_t< T >, basic_value< C, M, V > > >, detail::negation< std::is_same< std::string, detail::remove_cvref_t< T > > >, detail::negation< detail::is_string_literal< typename std::remove_reference< T >::type > > >::value, detail::remove_cvref_t< T > > find_or(const basic_value< C, M, V > &v, const toml::key &ky, T &&opt)

(12) template <typename Value, typename ... Ks, typename detail::enable_if_t<(sizeof...(Ks) > 1), std::nullptr_t > = nullptr>
     auto find_or(Value &&v, const toml::key &ky, Ks &&... keys) -> decltype(find_or(std::forward< Value >(v), ky, detail::last_one(std::forward< Ks >(keys)...)))

(13) template <typename T, typename Value, typename ... Ks, typename detail::enable_if_t<(sizeof...(Ks) > 1), std::nullptr_t > = nullptr>
     auto find_or(Value &&v, const toml::key &ky, Ks &&... keys) -> decltype(find_or< T >(std::forward< Value >(v), ky, detail::last_one(std::forward< Ks >(keys)...)))

Function overload

Synopsis

#include <toml/get.hpp>

template <typename C, template< typename ... > class M, template< typename ... > class V>
basic_value< C, M, V > const  & find_or(const basic_value< C, M, V > &v, const key &ky, const basic_value< C, M, V > &opt)

Description

No description yet.

Mentioned in

Source

Lines 897-907 in toml/get.hpp.

template<typename C,
         template<typename ...> class M, template<typename ...> class V>
basic_value<C, M, V> const&
find_or(const basic_value<C, M, V>& v, const key& ky,
        const basic_value<C, M, V>& opt)
{
    if(!v.is_table()) {return opt;}
    const auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return opt;}
    return tab.at(ky);
}

Synopsis

#include <toml/get.hpp>

template <typename C, template< typename ... > class M, template< typename ... > class V>
basic_value< C, M, V > & find_or(basic_value< C, M, V > &v, const toml::key &ky, basic_value< C, M, V > &opt)

Description

No description yet.

Mentioned in

Source

Lines 909-918 in toml/get.hpp.

template<typename C,
         template<typename ...> class M, template<typename ...> class V>
basic_value<C, M, V>&
find_or(basic_value<C, M, V>& v, const toml::key& ky, basic_value<C, M, V>& opt)
{
    if(!v.is_table()) {return opt;}
    auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return opt;}
    return tab.at(ky);
}

Synopsis

#include <toml/get.hpp>

template <typename C, template< typename ... > class M, template< typename ... > class V>
basic_value< C, M, V > find_or(basic_value< C, M, V > &&v, const toml::key &ky, basic_value< C, M, V > &&opt)

Description

No description yet.

Mentioned in

Source

Lines 920-929 in toml/get.hpp.

template<typename C,
         template<typename ...> class M, template<typename ...> class V>
basic_value<C, M, V>
find_or(basic_value<C, M, V>&& v, const toml::key& ky, basic_value<C, M, V>&& opt)
{
    if(!v.is_table()) {return opt;}
    auto tab = std::move(v).as_table();
    if(tab.count(ky) == 0) {return opt;}
    return basic_value<C, M, V>(std::move(tab.at(ky)));
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< detail::is_exact_toml_type< T, basic_value< C, M, V > >::value, T > const  & find_or(const basic_value< C, M, V > &v, const key &ky, const T &opt)

Description

No description yet.

Mentioned in

Source

Lines 933-943 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<
    detail::is_exact_toml_type<T, basic_value<C, M, V>>::value, T> const&
find_or(const basic_value<C, M, V>& v, const key& ky, const T& opt)
{
    if(!v.is_table()) {return opt;}
    const auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return opt;}
    return get_or(tab.at(ky), opt);
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< detail::is_exact_toml_type< T, basic_value< C, M, V > >::value, T > & find_or(basic_value< C, M, V > &v, const toml::key &ky, T &opt)

Description

No description yet.

Mentioned in

Source

Lines 945-955 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<
    detail::is_exact_toml_type<T, basic_value<C, M, V>>::value, T>&
find_or(basic_value<C, M, V>& v, const toml::key& ky, T& opt)
{
    if(!v.is_table()) {return opt;}
    auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return opt;}
    return get_or(tab.at(ky), opt);
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< detail::is_exact_toml_type< T, basic_value< C, M, V > >::value, detail::remove_cvref_t< T > > find_or(basic_value< C, M, V > &&v, const toml::key &ky, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 957-968 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<
    detail::is_exact_toml_type<T, basic_value<C, M, V>>::value,
    detail::remove_cvref_t<T>>
find_or(basic_value<C, M, V>&& v, const toml::key& ky, T&& opt)
{
    if(!v.is_table()) {return std::forward<T>(opt);}
    auto tab = std::move(v).as_table();
    if(tab.count(ky) == 0) {return std::forward<T>(opt);}
    return get_or(std::move(tab.at(ky)), std::forward<T>(opt));
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< std::is_same< T, std::string >::value, std::string > const  & find_or(const basic_value< C, M, V > &v, const key &ky, const T &opt)

Description

No description yet.

Mentioned in

Source

Lines 973-982 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<std::is_same<T, std::string>::value, std::string> const&
find_or(const basic_value<C, M, V>& v, const key& ky, const T& opt)
{
    if(!v.is_table()) {return opt;}
    const auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return opt;}
    return get_or(tab.at(ky), opt);
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< std::is_same< T, std::string >::value, std::string > & find_or(basic_value< C, M, V > &v, const toml::key &ky, T &opt)

Description

No description yet.

Mentioned in

Source

Lines 983-992 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<std::is_same<T, std::string>::value, std::string>&
find_or(basic_value<C, M, V>& v, const toml::key& ky, T& opt)
{
    if(!v.is_table()) {return opt;}
    auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return opt;}
    return get_or(tab.at(ky), opt);
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< std::is_same< T, std::string >::value, std::string > find_or(basic_value< C, M, V > &&v, const toml::key &ky, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 993-1002 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<std::is_same<T, std::string>::value, std::string>
find_or(basic_value<C, M, V>&& v, const toml::key& ky, T&& opt)
{
    if(!v.is_table()) {return std::forward<T>(opt);}
    auto tab = std::move(v).as_table();
    if(tab.count(ky) == 0) {return std::forward<T>(opt);}
    return get_or(std::move(tab.at(ky)), std::forward<T>(opt));
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< detail::is_string_literal< typename std::remove_reference< T >::type >::value, std::string > find_or(const basic_value< C, M, V > &v, const toml::key &ky, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 1006-1017 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<
    detail::is_string_literal<typename std::remove_reference<T>::type>::value,
    std::string>
find_or(const basic_value<C, M, V>& v, const toml::key& ky, T&& opt)
{
    if(!v.is_table()) {return std::string(opt);}
    const auto& tab = v.as_table();
    if(tab.count(ky) == 0) {return std::string(opt);}
    return get_or(tab.at(ky), std::forward<T>(opt));
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
detail::enable_if_t< detail::conjunction< detail::negation< detail::is_exact_toml_type< detail::remove_cvref_t< T >, basic_value< C, M, V > > >, detail::negation< std::is_same< std::string, detail::remove_cvref_t< T > > >, detail::negation< detail::is_string_literal< typename std::remove_reference< T >::type > > >::value, detail::remove_cvref_t< T > > find_or(const basic_value< C, M, V > &v, const toml::key &ky, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 1030-1039 in toml/get.hpp.

detail::negation<detail::is_string_literal<
    typename std::remove_reference<T>::type>>
>::value, detail::remove_cvref_t<T>>
_or(const basic_value<C, M, V>& v, const toml::key& ky, T&& opt)
if(!v.is_table()) {return std::forward<T>(opt);}
const auto& tab = v.as_table();
if(tab.count(ky) == 0) {return std::forward<T>(opt);}
return get_or(tab.at(ky), std::forward<T>(opt));

Synopsis

#include <toml/get.hpp>

template <typename Value, typename ... Ks, typename detail::enable_if_t<(sizeof...(Ks) > 1), std::nullptr_t > = nullptr>
auto find_or(Value &&v, const toml::key &ky, Ks &&... keys) -> decltype(find_or(std::forward< Value >(v), ky, detail::last_one(std::forward< Ks >(keys)...)))

Description

No description yet.

Mentioned in

Source

Lines 1048-1061 in toml/get.hpp.

auto find_or(Value&& v, const toml::key& ky, Ks&& ... keys)
    -> decltype(find_or(std::forward<Value>(v), ky, detail::last_one(std::forward<Ks>(keys)...)))
{
    if(!v.is_table())
    {
        return detail::last_one(std::forward<Ks>(keys)...);
    }
    auto&& tab = std::forward<Value>(v).as_table();
    if(tab.count(ky) == 0)
    {
        return detail::last_one(std::forward<Ks>(keys)...);
    }
    return find_or(std::forward<decltype(tab)>(tab).at(ky), std::forward<Ks>(keys)...);
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename Value, typename ... Ks, typename detail::enable_if_t<(sizeof...(Ks) > 1), std::nullptr_t > = nullptr>
auto find_or(Value &&v, const toml::key &ky, Ks &&... keys) -> decltype(find_or< T >(std::forward< Value >(v), ky, detail::last_one(std::forward< Ks >(keys)...)))

Description

No description yet.

Mentioned in

Source

Lines 1070-1083 in toml/get.hpp.

auto find_or(Value&& v, const toml::key& ky, Ks&& ... keys)
    -> decltype(find_or<T>(std::forward<Value>(v), ky, detail::last_one(std::forward<Ks>(keys)...)))
{
    if(!v.is_table())
    {
        return detail::last_one(std::forward<Ks>(keys)...);
    }
    auto&& tab = std::forward<Value>(v).as_table();
    if(tab.count(ky) == 0)
    {
        return detail::last_one(std::forward<Ks>(keys)...);
    }
    return find_or(std::forward<decltype(tab)>(tab).at(ky), std::forward<Ks>(keys)...);
}





Add Discussion as Guest

Log in