refactor: rm template from detail::change_region

This commit is contained in:
ToruNiina 2020-07-27 23:04:24 +09:00
parent bc219af5b5
commit 22ace027de

View File

@ -27,16 +27,10 @@ inline region_base const* get_region(const Value& v)
return v.region_info_.get(); return v.region_info_.get();
} }
template<typename Value, typename Region> template<typename Value>
void change_region(Value& v, Region&& reg) void change_region(Value& v, region reg)
{ {
using region_type = typename std::remove_reference< v.region_info_ = std::make_shared<region>(std::move(reg));
typename std::remove_cv<Region>::type
>::type;
std::shared_ptr<region_base> new_reg =
std::make_shared<region_type>(std::forward<region_type>(reg));
v.region_info_ = new_reg;
return; return;
} }
@ -1709,8 +1703,8 @@ class basic_value
template<typename Value> template<typename Value>
friend region_base const* detail::get_region(const Value& v); friend region_base const* detail::get_region(const Value& v);
template<typename Value, typename Region> template<typename Value>
friend void detail::change_region(Value& v, Region&& reg); friend void detail::change_region(Value& v, region reg);
private: private: