77#include < ios>
88#include < iterator>
99#include < ostream>
10+ #include < ranges>
1011#include < sstream>
1112#include < string>
1213#include < utility>
@@ -106,7 +107,7 @@ auto multiply_sequence_helper(const T* source, const integer_object::value_type
106107{
107108 typename T::value_type target;
108109 for (integer_object::value_type i = 0 ; i < count; i++) {
109- std::copy (source->value . cbegin (), source-> value . cend () , std::back_inserter (target));
110+ std::ranges:: copy (source->value , std::back_inserter (target));
110111 }
111112 return allocate<T>(std::move (target));
112113}
@@ -779,11 +780,8 @@ auto array_object::operator==(const object& other) const -> const object*
779780 if (other_value.size () != value.size ()) {
780781 return fals ();
781782 }
782- const auto eq = std::equal (value.cbegin (),
783- value.cend (),
784- other_value.cbegin (),
785- other_value.cend (),
786- [](const object* a, const object* b) { return object_eq (*a, *b); });
783+ const auto eq = std::ranges::equal (
784+ value, other_value, [](const object* a, const object* b) -> bool { return object_eq (*a, *b); });
787785 return native_bool_to_object (eq);
788786 }
789787 return fals ();
@@ -802,7 +800,7 @@ auto array_object::operator+(const object& other) const -> const object*
802800 if (other.is (array)) {
803801 value_type concat = value;
804802 const auto & other_value = other.as <array_object>()->value ;
805- std::copy (other_value. cbegin (), other_value. cend () , std::back_inserter (concat));
803+ std::ranges:: copy (other_value, std::back_inserter (concat));
806804 return allocate<array_object>(std::move (concat));
807805 }
808806 return nullptr ;
@@ -812,9 +810,9 @@ auto operator<<(std::ostream& strm, const hashable::key_type& t) -> std::ostream
812810{
813811 std::visit (
814812 overloaded {
815- [&](const int64_t val) { strm << val; },
816- [&](const std::string& val) { strm << ' "' << val << ' "' ; },
817- [&](const bool val) { strm << std::boolalpha << val; },
813+ [&](const int64_t val) -> void { strm << val; },
814+ [&](const std::string& val) -> void { strm << ' "' << val << ' "' ; },
815+ [&](const bool val) -> void { strm << std::boolalpha << val; },
818816 },
819817 t);
820818 return strm;
@@ -843,14 +841,13 @@ auto hash_object::operator==(const object& other) const -> const object*
843841 if (other_value.size () != value.size ()) {
844842 return fals ();
845843 }
846- const auto eq = std::all_of (value.cbegin (),
847- value.cend (),
848- [&other_value](const auto & pair)
849- {
850- const auto & [key, value] = pair;
851- auto it = other_value.find (key);
852- return it != other_value.cend () && object_eq (*(it->second ), *value);
853- });
844+ const auto eq = std::ranges::all_of (value,
845+ [&other_value](const auto & pair) -> auto
846+ {
847+ const auto & [key, value] = pair;
848+ auto it = other_value.find (key);
849+ return it != other_value.cend () && object_eq (*(it->second ), *value);
850+ });
854851 return native_bool_to_object (eq);
855852 }
856853 return object::operator ==(other);
0 commit comments