diff --git a/toml/value.hpp b/toml/value.hpp index 9e44cba..5defd95 100644 --- a/toml/value.hpp +++ b/toml/value.hpp @@ -529,14 +529,6 @@ class basic_value assigner(this->boolean_, b); return *this; } - template - basic_value(boolean b, detail::region reg) - : type_(value_t::boolean), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->boolean_, b); - } basic_value(boolean b, std::vector comments) : type_(value_t::boolean), region_info_(std::make_shared(region_base{})), @@ -557,19 +549,6 @@ class basic_value assigner(this->integer_, static_cast(i)); } - template, - detail::negation> - >::value, std::nullptr_t>::type = nullptr> - basic_value(T i, detail::region reg) - : type_(value_t::integer), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->integer_, static_cast(i)); - } - template, detail::negation>>::value, std::nullptr_t>::type = nullptr> @@ -604,15 +583,6 @@ class basic_value assigner(this->floating_, static_cast(f)); } - template::value, std::nullptr_t>::type = nullptr> - basic_value(T f, detail::region reg) - : type_(value_t::floating), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->floating_, static_cast(f)); - } template::value, std::nullptr_t>::type = nullptr> @@ -643,14 +613,6 @@ class basic_value { assigner(this->string_, std::move(s)); } - template - basic_value(toml::string s, detail::region reg) - : type_(value_t::string), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->string_, std::move(s)); - } basic_value& operator=(toml::string s) { this->cleanup(); @@ -782,14 +744,6 @@ class basic_value { assigner(this->local_date_, ld); } - template - basic_value(const local_date& ld, detail::region reg) - : type_(value_t::local_date), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->local_date_, ld); - } basic_value& operator=(const local_date& ld) { this->cleanup(); @@ -814,14 +768,6 @@ class basic_value { assigner(this->local_time_, lt); } - template - basic_value(const local_time& lt, detail::region reg) - : type_(value_t::local_time), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->local_time_, lt); - } basic_value(const local_time& lt, std::vector comments) : type_(value_t::local_time), region_info_(std::make_shared(region_base{})), @@ -872,14 +818,6 @@ class basic_value { assigner(this->local_datetime_, ldt); } - template - basic_value(const local_datetime& ldt, detail::region reg) - : type_(value_t::local_datetime), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->local_datetime_, ldt); - } basic_value(const local_datetime& ldt, std::vector comments) : type_(value_t::local_datetime), region_info_(std::make_shared(region_base{})), @@ -904,14 +842,6 @@ class basic_value { assigner(this->offset_datetime_, odt); } - template - basic_value(const offset_datetime& odt, detail::region reg) - : type_(value_t::offset_datetime), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->offset_datetime_, odt); - } basic_value(const offset_datetime& odt, std::vector comments) : type_(value_t::offset_datetime), region_info_(std::make_shared(region_base{})), @@ -958,14 +888,6 @@ class basic_value { assigner(this->array_, ary); } - template - basic_value(const array_type& ary, detail::region reg) - : type_(value_t::array), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->array_, ary); - } basic_value(const array_type& ary, std::vector comments) : type_(value_t::array), region_info_(std::make_shared(region_base{})), @@ -1079,14 +1001,6 @@ class basic_value { assigner(this->table_, tab); } - template - basic_value(const table_type& tab, detail::region reg) - : type_(value_t::table), - region_info_(std::make_shared>(std::move(reg))), - comments_(region_info_->comments()) - { - assigner(this->table_, tab); - } basic_value(const table_type& tab, std::vector comments) : type_(value_t::table), region_info_(std::make_shared(region_base{})), @@ -1216,6 +1130,93 @@ class basic_value } // for internal use ------------------------------------------------------ + // + // Those constructors take detail::region that contains parse result. + + template + basic_value(boolean b, detail::region reg) + : type_(value_t::boolean), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->boolean_, b); + } + template, detail::negation> + >::value, std::nullptr_t>::type = nullptr> + basic_value(T i, detail::region reg) + : type_(value_t::integer), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->integer_, static_cast(i)); + } + template::value, std::nullptr_t>::type = nullptr> + basic_value(T f, detail::region reg) + : type_(value_t::floating), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->floating_, static_cast(f)); + } + template + basic_value(toml::string s, detail::region reg) + : type_(value_t::string), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->string_, std::move(s)); + } + template + basic_value(const local_date& ld, detail::region reg) + : type_(value_t::local_date), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->local_date_, ld); + } + template + basic_value(const local_time& lt, detail::region reg) + : type_(value_t::local_time), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->local_time_, lt); + } + template + basic_value(const local_datetime& ldt, detail::region reg) + : type_(value_t::local_datetime), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->local_datetime_, ldt); + } + template + basic_value(const offset_datetime& odt, detail::region reg) + : type_(value_t::offset_datetime), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->offset_datetime_, odt); + } + template + basic_value(const array_type& ary, detail::region reg) + : type_(value_t::array), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->array_, ary); + } + template + basic_value(const table_type& tab, detail::region reg) + : type_(value_t::table), + region_info_(std::make_shared>(std::move(reg))), + comments_(region_info_->comments()) + { + assigner(this->table_, tab); + } template::value,