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
- Getting Started / Obtaining Basic Values
- Getting Started / Nested Tables
- Getting Started / Arrays of Tables
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 {};
}
}