diff --git a/include/bitlib/bit-algorithms/to_from_string.hpp b/include/bitlib/bit-algorithms/to_from_string.hpp index e2d5eb1..c57ee3d 100644 --- a/include/bitlib/bit-algorithms/to_from_string.hpp +++ b/include/bitlib/bit-algorithms/to_from_string.hpp @@ -1,7 +1,7 @@ -// ================================= array_REF =================================== // +// ============================= to_from_string ============================= // // Project: The Experimental Bit Algorithms Library -// \file to_string.hpp -// Description: Implementation of array_ref +// \file to_from_string.hpp +// Description: Implementation of to_string and from_string // Creator: Vincent Reverdy // Contributor: Peter McLean [2025] // License: BSD 3-Clause License @@ -275,7 +275,7 @@ constexpr CharIt to_string( return to_string(bits, str_first, str_last, meta); } -template > +template ::value_type>> constexpr void from_string( const CharIt str_first, const CharIt str_last, const bit_iterator& bit_first, const bit_iterator& bit_last, @@ -356,7 +356,7 @@ constexpr void from_string( template > + typename Policy = policy::typical::value_type>> constexpr void from_string( const CharIt str_first, const CharIt str_last, const bit_iterator& bit_first, const bit_iterator& bit_last) { @@ -410,7 +410,7 @@ constexpr std::vector from_string( return from_string(first, last, meta); } -template > +template ::value_type>> constexpr void from_string( const std::string& str, const bit_iterator& bit_first, const bit_iterator& bit_last) { @@ -418,7 +418,7 @@ constexpr void from_string( from_string(str.c_str(), str.c_str() + str.length(), bit_first, bit_last); } -template ::value_type>> +template ::word_type>> constexpr void from_string( const std::string& str, RangeT&& bits) { @@ -427,7 +427,7 @@ constexpr void from_string( from_string(str.begin(), str.end(), bits.begin(), bits.end()); } -template > +template ::value_type>> constexpr void from_string( const std::string& str, const bit_iterator& bit_first, const bit_iterator& bit_last, @@ -438,7 +438,7 @@ constexpr void from_string( meta); } -template ::value_type>> +template ::word_type>> constexpr void from_string( const std::string& str, RangeT&& bits, @@ -451,6 +451,25 @@ constexpr void from_string( meta); } +template ::word_type>> +constexpr void from_string( + const CharIt first, const CharIt last, + RangeT&& bits, + string::metadata_t meta = string::typical()) { + using range_iterator_t = std::ranges::iterator_t; + using RandomAccessIt = typename range_iterator_t::iterator_type; + from_string(first, last, bits.begin(), bits.end(), meta); +} + +template ::word_type>> +constexpr void from_string( + const CharIt first, const CharIt last, + RangeT&& bits) { + using range_iterator_t = std::ranges::iterator_t; + using RandomAccessIt = typename range_iterator_t::iterator_type; + return from_string(first, last, bits.begin(), bits.end(), meta); +} + } // namespace bit -#endif // _BIT_TO_STRING_HPP_INCLUDED \ No newline at end of file +#endif // _BIT_TO_STRING_HPP_INCLUDED \ No newline at end of file