Function push_back
Summary
#include <include/cpptoml.h>
(1) template <class T>
void push_back(const std::shared_ptr< value< T >> &val)
(2) void push_back(const std::shared_ptr< array > &val)
(3) template <class T>
void push_back(T &&val, typename value_traits< T >::type *=0)
Function overload
Synopsis
#include <include/cpptoml.h>
template <class T>
void push_back(const std::shared_ptr< value< T >> &val)
Description
Add a value to the end of the array
Source
Lines 896-907 in include/cpptoml.h.
template <class T>
void push_back(const std::shared_ptr<value<T>>& val)
{
if (values_.empty() || values_[0]->as<T>())
{
values_.push_back(val);
}
else
{
throw array_exception{"Arrays must be homogenous."};
}
}
Synopsis
#include <include/cpptoml.h>
void push_back(const std::shared_ptr< array > &val)
Description
Add an array to the end of the array
Source
Lines 912-922 in include/cpptoml.h.
void push_back(const std::shared_ptr<array>& val)
{
if (values_.empty() || values_[0]->is_array())
{
values_.push_back(val);
}
else
{
throw array_exception{"Arrays must be homogenous."};
}
}
Synopsis
#include <include/cpptoml.h>
template <class T>
void push_back(T &&val, typename value_traits< T >::type *=0)
Description
Convenience function for adding a simple element to the end of the array.
Source
Lines 928-932 in include/cpptoml.h.
template <class T>
void push_back(T&& val, typename value_traits<T>::type* = 0)
{
push_back(make_value(std::forward<T>(val)));
}