Function get_if

Summary

#include <src/c4/yml/node.hpp>

(1) template <class T>
    void get_if(csubstr const &name, T *var) const

(2) template <class T>
    void get_if(csubstr const &name, T *var, T const &fallback) const

Function overload

Synopsis

#include <src/c4/yml/node.hpp>

template <class T>
void get_if(csubstr const &name, T *var) const

Description

No description yet.

Source

Lines 444-452 in src/c4/yml/node.hpp.

template<class T>
void get_if(csubstr const& name, T *var) const
{
    auto ch = find_child(name);
    if(ch.valid())
    {
        ch >> *var;
    }
}

Synopsis

#include <src/c4/yml/node.hpp>

template <class T>
void get_if(csubstr const &name, T *var, T const &fallback) const

Description

No description yet.

Source

Lines 454-466 in src/c4/yml/node.hpp.

template<class T>
void get_if(csubstr const& name, T *var, T const& fallback) const
{
    auto ch = find_child(name);
    if(ch.valid())
    {
        ch >> *var;
    }
    else
    {
        *var = fallback;
    }
}





Add Discussion as Guest

Log in