Function accept

Synopsis

#include <include/cpptoml.h>

template <class Visitor, class... Args>
void accept(Visitor &&visitor, Args &&... args) const

Description

base implementation of accept() that calls visitor.visit() on the concrete class.

Source

Lines 3269-3295 in include/cpptoml.h. Line 577 in include/cpptoml.h.

template <class Visitor, class... Args>
void base::accept(Visitor&& visitor, Args&&... args) const
{
    if (is_value())
    {
        using value_acceptor
            = value_accept<std::string, int64_t, double, bool, local_date,
                           local_time, local_datetime, offset_datetime>;
        value_acceptor::accept(*this, std::forward<Visitor>(visitor),
                               std::forward<Args>(args)...);
    }
    else if (is_table())
    {
        visitor.visit(static_cast<const table&>(*this),
                      std::forward<Args>(args)...);
    }
    else if (is_array())
    {
        visitor.visit(static_cast<const array&>(*this),
                      std::forward<Args>(args)...);
    }
    else if (is_table_array())
    {
        visitor.visit(static_cast<const table_array&>(*this),
                      std::forward<Args>(args)...);
    }
}





Add Discussion as Guest

Log in