Function get_or

Summary

#include <toml/get.hpp>

(1) template <typename C, template< typename ... > class M, template< typename ... > class V>
    basic_value< C, M, V > const  & get_or(const basic_value< C, M, V > &v, const basic_value< C, M, V > &)

(2) template <typename C, template< typename ... > class M, template< typename ... > class V>
    basic_value< C, M, V > & get_or(basic_value< C, M, V > &v, basic_value< C, M, V > &)

(3) template <typename C, template< typename ... > class M, template< typename ... > class V>
    basic_value< C, M, V > get_or(basic_value< C, M, V > &&v, basic_value< C, M, V > &&)

(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  & get_or(const basic_value< C, M, V > &v, 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 > & get_or(basic_value< C, M, V > &v, 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< detail::remove_cvref_t< T >, basic_value< C, M, V > >::value, detail::remove_cvref_t< T > > get_or(basic_value< C, M, V > &&v, T &&opt)

(7) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< std::is_same< detail::remove_cvref_t< T >, std::string >::value, std::string > const  & get_or(const basic_value< C, M, V > &v, 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 > & get_or(basic_value< C, M, V > &v, T &opt)

(9) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    detail::enable_if_t< std::is_same< detail::remove_cvref_t< T >, std::string >::value, std::string > get_or(basic_value< C, M, V > &&v, 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 > get_or(const basic_value< C, M, V > &v, 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 > > get_or(const basic_value< C, M, V > &v, T &&opt)

Function overload

Synopsis

#include <toml/get.hpp>

template <typename C, template< typename ... > class M, template< typename ... > class V>
basic_value< C, M, V > const  & get_or(const basic_value< C, M, V > &v, const basic_value< C, M, V > &)

Description

No description yet.

Mentioned in

Source

Lines 732-738 in toml/get.hpp.

template<typename C,
         template<typename ...> class M, template<typename ...> class V>
basic_value<C, M, V> const&
get_or(const basic_value<C, M, V>& v, const basic_value<C, M, V>&)
{
    return v;
}

Synopsis

#include <toml/get.hpp>

template <typename C, template< typename ... > class M, template< typename ... > class V>
basic_value< C, M, V > & get_or(basic_value< C, M, V > &v, basic_value< C, M, V > &)

Description

No description yet.

Mentioned in

Source

Lines 739-745 in toml/get.hpp.

template<typename C,
         template<typename ...> class M, template<typename ...> class V>
basic_value<C, M, V>&
get_or(basic_value<C, M, V>& v, basic_value<C, M, V>&)
{
    return v;
}

Synopsis

#include <toml/get.hpp>

template <typename C, template< typename ... > class M, template< typename ... > class V>
basic_value< C, M, V > get_or(basic_value< C, M, V > &&v, basic_value< C, M, V > &&)

Description

No description yet.

Mentioned in

Source

Lines 746-752 in toml/get.hpp.

template<typename C,
         template<typename ...> class M, template<typename ...> class V>
basic_value<C, M, V>
get_or(basic_value<C, M, V>&& v, basic_value<C, M, V>&&)
{
    return v;
}

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  & get_or(const basic_value< C, M, V > &v, const T &opt)

Description

No description yet.

Mentioned in

Source

Lines 757-771 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&
get_or(const basic_value<C, M, V>& v, const T& opt)
{
    try
    {
        return get<detail::remove_cvref_t<T>>(v);
    }
    catch(...)
    {
        return 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 > & get_or(basic_value< C, M, V > &v, T &opt)

Description

No description yet.

Mentioned in

Source

Lines 772-786 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>&
get_or(basic_value<C, M, V>& v, T& opt)
{
    try
    {
        return get<detail::remove_cvref_t<T>>(v);
    }
    catch(...)
    {
        return 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< detail::remove_cvref_t< T >, basic_value< C, M, V > >::value, detail::remove_cvref_t< T > > get_or(basic_value< C, M, V > &&v, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 787-801 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<detail::remove_cvref_t<T>,
    basic_value<C, M, V>>::value, detail::remove_cvref_t<T>>
get_or(basic_value<C, M, V>&& v, T&& opt)
{
    try
    {
        return get<detail::remove_cvref_t<T>>(std::move(v));
    }
    catch(...)
    {
        return detail::remove_cvref_t<T>(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< detail::remove_cvref_t< T >, std::string >::value, std::string > const  & get_or(const basic_value< C, M, V > &v, const T &opt)

Description

No description yet.

Mentioned in

Source

Lines 806-820 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<std::is_same<detail::remove_cvref_t<T>, std::string>::value,
    std::string> const&
get_or(const basic_value<C, M, V>& v, const T& opt)
{
    try
    {
        return v.as_string().str;
    }
    catch(...)
    {
        return 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 > & get_or(basic_value< C, M, V > &v, T &opt)

Description

No description yet.

Mentioned in

Source

Lines 821-834 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>&
get_or(basic_value<C, M, V>& v, T& opt)
{
    try
    {
        return v.as_string().str;
    }
    catch(...)
    {
        return 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< detail::remove_cvref_t< T >, std::string >::value, std::string > get_or(basic_value< C, M, V > &&v, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 835-849 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
detail::enable_if_t<
    std::is_same<detail::remove_cvref_t<T>, std::string>::value, std::string>
get_or(basic_value<C, M, V>&& v, T&& opt)
{
    try
    {
        return std::move(v.as_string().str);
    }
    catch(...)
    {
        return std::string(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 > get_or(const basic_value< C, M, V > &v, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 854-868 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>
get_or(const basic_value<C, M, V>& v, T&& opt)
{
    try
    {
        return std::move(v.as_string().str);
    }
    catch(...)
    {
        return std::string(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 > > get_or(const basic_value< C, M, V > &v, T &&opt)

Description

No description yet.

Mentioned in

Source

Lines 873-892 in 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>>
get_or(const basic_value<C, M, V>& v, T&& opt)
{
    try
    {
        return get<detail::remove_cvref_t<T>>(v);
    }
    catch(...)
    {
        return detail::remove_cvref_t<T>(std::forward<T>(opt));
    }
}





Add Discussion as Guest

Log in