Function expect

Summary

#include <toml/get.hpp>

(1) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    result< T, std::string > expect(const basic_value< C, M, V > &v) noexcept

(2) template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
    result< T, std::string > expect(const basic_value< C, M, V > &v, const toml::key &k) noexcept

Function overload

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
result< T, std::string > expect(const basic_value< C, M, V > &v) noexcept

Description

No description yet.

Mentioned in

Source

Lines 1088-1100 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
result<T, std::string> expect(const basic_value<C, M, V>& v) noexcept
{
    try
    {
        return ok(get<T>(v));
    }
    catch(const std::exception& e)
    {
        return err(e.what());
    }
}

Synopsis

#include <toml/get.hpp>

template <typename T, typename C, template< typename ... > class M, template< typename ... > class V>
result< T, std::string > expect(const basic_value< C, M, V > &v, const toml::key &k) noexcept

Description

No description yet.

Mentioned in

Source

Lines 1101-1114 in toml/get.hpp.

template<typename T, typename C,
         template<typename ...> class M, template<typename ...> class V>
result<T, std::string>
expect(const basic_value<C, M, V>& v, const toml::key& k) noexcept
{
    try
    {
        return ok(find<T>(v, k));
    }
    catch(const std::exception& e)
    {
        return err(e.what());
    }
}





Add Discussion as Guest

Log in