From 0d623856a7d0b5aef1c6eef004bd359d6758f62e Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 27 Apr 2019 16:22:23 +0900 Subject: [PATCH] feat: add value::as_something() for convenience --- toml/value.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/toml/value.hpp b/toml/value.hpp index ef4bd15..31910e2 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -607,6 +607,28 @@ class value template typename detail::toml_default_type::type&& cast() &&; + boolean const& as_boolean() const {return this->cast();} + integer const& as_integer() const {return this->cast();} + floating const& as_floating() const {return this->cast();} + string const& as_string() const {return this->cast();} + offset_datetime const& as_offset_datetime() const {return this->cast();} + local_datetime const& as_local_datetime() const {return this->cast();} + local_date const& as_local_date() const {return this->cast();} + local_time const& as_local_time() const {return this->cast();} + array const& as_array() const {return this->cast();} + table const& as_table() const {return this->cast();} + + boolean& as_boolean() {return this->cast();} + integer& as_integer() {return this->cast();} + floating& as_floating() {return this->cast();} + string& as_string() {return this->cast();} + offset_datetime& as_offset_datetime() {return this->cast();} + local_datetime& as_local_datetime() {return this->cast();} + local_date& as_local_date() {return this->cast();} + local_time& as_local_time() {return this->cast();} + array& as_array() {return this->cast();} + table& as_table() {return this->cast();} + private: void cleanup() noexcept