diff --git a/include/seqan3/range/container/bitcompressed_vector.hpp b/include/seqan3/range/container/bitcompressed_vector.hpp index 11d36863cbf..2f3daf423e7 100644 --- a/include/seqan3/range/container/bitcompressed_vector.hpp +++ b/include/seqan3/range/container/bitcompressed_vector.hpp @@ -518,6 +518,19 @@ class bitcompressed_vector return (*this)[size()-1]; } + //!\brief Direct access to the underlying SDSL vector. + constexpr data_type & raw_data() noexcept + { + return data; + } + + //!\copydoc raw_data() + constexpr data_type const & raw_data() const noexcept + { + return data; + } + //!\} + /*!\name Capacity * \{ */ @@ -964,37 +977,37 @@ class bitcompressed_vector //!\brief Checks whether `*this` is equal to `rhs`. constexpr bool operator==(bitcompressed_vector const & rhs) const noexcept { - return data == rhs.data; + return raw_data() == rhs.raw_data(); } //!\brief Checks whether `*this` is not equal to `rhs`. constexpr bool operator!=(bitcompressed_vector const & rhs) const noexcept { - return data != rhs.data; + return raw_data() != rhs.raw_data(); } //!\brief Checks whether `*this` is less than `rhs`. constexpr bool operator<(bitcompressed_vector const & rhs) const noexcept { - return data < rhs.data; + return raw_data() < rhs.raw_data(); } //!\brief Checks whether `*this` is greater than `rhs`. constexpr bool operator>(bitcompressed_vector const & rhs) const noexcept { - return data > rhs.data; + return raw_data() > rhs.raw_data(); } //!\brief Checks whether `*this` is less than or equal to `rhs`. constexpr bool operator<=(bitcompressed_vector const & rhs) const noexcept { - return data <= rhs.data; + return raw_data() <= rhs.raw_data(); } //!\brief Checks whether `*this` is greater than or equal to `rhs`. constexpr bool operator>=(bitcompressed_vector const & rhs) const noexcept { - return data >= rhs.data; + return raw_data() >= rhs.raw_data(); } //!\} @@ -1008,7 +1021,7 @@ class bitcompressed_vector template void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive) { - archive(data); //TODO: data not yet serialisable + archive(data); } //!\endcond }; diff --git a/include/seqan3/range/container/concatenated_sequences.hpp b/include/seqan3/range/container/concatenated_sequences.hpp index 6d16663e19c..d3988bdd174 100644 --- a/include/seqan3/range/container/concatenated_sequences.hpp +++ b/include/seqan3/range/container/concatenated_sequences.hpp @@ -53,7 +53,7 @@ namespace seqan3 * * Better cache locality when parsing the sequences linearly (and often also on random access). * * Constant time access to the concatenation of the sequences via concat(). * * This access is also writable so that certain transformations can be done globally, instead of element-wise. - * * Also direct access to the delimiters via data() [this is used by some algorithms]. + * * Also direct access to the delimiters via raw_data() [this is used by some algorithms]. * * The disadvantages are: * @@ -602,13 +602,13 @@ class concatenated_sequences * * This exact representation of the data is implementation defined. Do not rely on it for API stability. */ - std::pair data() + std::pair raw_data() { return {data_values, data_delimiters}; } - //!\copydoc data() - std::pair data() const + //!\copydoc raw_data() + std::pair raw_data() const { return {std::as_const(data_values), std::as_const(data_delimiters)}; } @@ -1243,37 +1243,37 @@ class concatenated_sequences //!\brief Checks whether `*this` is equal to `rhs`. constexpr bool operator==(concatenated_sequences const & rhs) const noexcept { - return data() == rhs.data(); + return raw_data() == rhs.raw_data(); } //!\brief Checks whether `*this` is not equal to `rhs`. constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept { - return data() != rhs.data(); + return raw_data() != rhs.raw_data(); } //!\brief Checks whether `*this` is less than `rhs`. constexpr bool operator<(concatenated_sequences const & rhs) const noexcept { - return data() < rhs.data(); + return raw_data() < rhs.raw_data(); } //!\brief Checks whether `*this` is greater than `rhs`. constexpr bool operator>(concatenated_sequences const & rhs) const noexcept { - return data() > rhs.data(); + return raw_data() > rhs.raw_data(); } //!\brief Checks whether `*this` is less than or equal to `rhs`. constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept { - return data() <= rhs.data(); + return raw_data() <= rhs.raw_data(); } //!\brief Checks whether `*this` is greater than or equal to `rhs`. constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept { - return data() >= rhs.data(); + return raw_data() >= rhs.raw_data(); } //!\} diff --git a/test/unit/range/container/container_of_container_test.cpp b/test/unit/range/container/container_of_container_test.cpp index 9bde16e716a..af87a89c67a 100644 --- a/test/unit/range/container/container_of_container_test.cpp +++ b/test/unit/range/container/container_of_container_test.cpp @@ -152,10 +152,10 @@ TYPED_TEST(container_of_container, element_access) EXPECT_EQ(dna4_vector(t2.concat()), "ACGTACGTGAGGA"_dna4); // data - EXPECT_EQ(std::get<0>(t1.data()), "ACGTACGTGAGGA"_dna4); - EXPECT_EQ(std::get<0>(t2.data()), "ACGTACGTGAGGA"_dna4); - EXPECT_EQ(std::get<1>(t1.data()), (std::vector{0, 4, 8, 13})); - EXPECT_EQ(std::get<1>(t2.data()), (std::vector{0, 4, 8, 13})); + EXPECT_EQ(std::get<0>(t1.raw_data()), "ACGTACGTGAGGA"_dna4); + EXPECT_EQ(std::get<0>(t2.raw_data()), "ACGTACGTGAGGA"_dna4); + EXPECT_EQ(std::get<1>(t1.raw_data()), (std::vector{0, 4, 8, 13})); + EXPECT_EQ(std::get<1>(t2.raw_data()), (std::vector{0, 4, 8, 13})); } }