Pipe notation does not compile with ranges::to
joergi-w opened this issue · 2 comments
joergi-w commented
Does this problem persist on the current master?
- I have verified the issue on the current master
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Compiler error with the pipe notation of seqan3::ranges::to
g++-12 -I ../repo/seqan3/include -I ../repo/seqan3/submodules/sdsl-lite/include -I ../repo/seqan3/submodules/cereal/include -std=c++20 -o args args.cpp
args.cpp: In function 'int main()':
args.cpp:10:75: error: no match for 'operator|' (operand types are 'std::ranges::transform_view<std::ranges::ref_view<std::vector<seqan3::dna5> >, <lambda(auto:23&&)> >' and '<unresolved overloaded function type>')
10 | seqan3::dna4_vector conv = seq | seqan3::views::convert<seqan3::dna4> | seqan3::ranges::to<std::vector>;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | <unresolved overloaded function type>
| std::ranges::transform_view<std::ranges::ref_view<std::vector<seqan3::dna5> >, <lambda(auto:23&&)> >
Expected Behavior
The following code snippets should be equivalent, but the first version works, the second not:
1 (everything fine)
seqan3::dna4_vector conv = seqan3::ranges::to<std::vector>(seq | seqan3::views::convert<seqan3::dna4>);
2 (compilation fails)
seqan3::dna4_vector conv = seq | seqan3::views::convert<seqan3::dna4> | seqan3::ranges::to<std::vector>;
Steps To Reproduce
Minimum example:
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include <seqan3/alphabet/nucleotide/dna5.hpp>
#include <seqan3/utility/range/to.hpp>
#include <seqan3/utility/views/convert.hpp>
int main()
{
using namespace seqan3::literals;
seqan3::dna5_vector seq = "CAGUCAGUCAGUCAGU"_dna5;
seqan3::dna4_vector conv = seq | seqan3::views::convert<seqan3::dna4> | seqan3::ranges::to<std::vector>;
return 0;
}
Environment
- Operating system: MacOS 11.6.5
- SeqAn version: commit e51658df (current master)
- Compiler: gcc 11.3.0 and 12.1.0 (Homebrew)
Anything else?
No response
eseiler commented
Needs to be seqan3::ranges::to<std::vector>()
. It's a function object in C++23.
joergi-w commented
Oh, thanks! That's an easy fix ;)
I was adjusting some code from seqan3::views::to
to the new API and failed at this point.
I think this issue can be closed.