Function get_as

Synopsis

#include <include/cpptoml.h>

template <class T>
option< T > get_as(const std::string &key) const

Description

Helper function that attempts to get a value corresponding to the template parameter from a given key.

Mentioned in

Source

Lines 1440-1451 in include/cpptoml.h.

template <class T>
option<T> get_as(const std::string& key) const
{
    try
    {
        return get_impl<T>(get(key));
    }
    catch (const std::out_of_range&)
    {
        return {};
    }
}





Add Discussion as Guest

Log in