feat: add detail::change_region_of_key

This commit is contained in:
ToruNiina
2024-07-27 16:39:46 +09:00
parent 2193c5c201
commit a39300f9d9

View File

@@ -53,6 +53,9 @@ error_info make_not_found_error(const basic_value<TC>&, const std::string&, cons
template<typename TC> template<typename TC>
void change_region_of_value(basic_value<TC>&, const basic_value<TC>&); void change_region_of_value(basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
void change_region_of_key(basic_value<TC>&, region);
template<typename TC, value_t V> template<typename TC, value_t V>
struct getter; struct getter;
} // detail } // detail
@@ -1847,6 +1850,9 @@ class basic_value
template<typename TC> template<typename TC>
friend void detail::change_region_of_value(basic_value<TC>&, const basic_value<TC>&); friend void detail::change_region_of_value(basic_value<TC>&, const basic_value<TC>&);
template<typename TC>
friend void change_region_of_key(basic_value<TC>&, detail::region);
template<typename TC> template<typename TC>
friend class basic_value; friend class basic_value;
@@ -2196,6 +2202,12 @@ void change_region_of_value(basic_value<TC>& dst, const basic_value<TC>& src)
dst.key_region_ = std::move(src.key_region_); dst.key_region_ = std::move(src.key_region_);
return; return;
} }
template<typename TC>
void change_region_of_key(basic_value<TC>& dst, region src)
{
dst.key_region_ = std::move(src);
return;
}
} // namespace detail } // namespace detail
} // namespace toml } // namespace toml