Normally, we do not allow implicit conversion of single argument constructors, but in this case we make an exception, because seqan3::rna15 and seqan3::dna15 are interchangeable as they behave nearly the same (e.g. same ranks, same char to rank conversion).
int main()
{
letter2 = 'C'_dna15;
}
The 15 letter RNA alphabet, containing all IUPAC smybols minus the gap.
Definition: rna15.hpp:51
Provides seqan3::dna15, container aliases and string literals.
The SeqAn namespace for literals.
Provides seqan3::rna15, container aliases and string literals.
seqan3::sequence
s (e.g. seqan3::rna15_vector) in general are not implicitly convertible and must be explicitly copied to be converted:
int main()
{
seqan3::rna15_vector vector{'A'_dna15, 'C'_dna15, 'G'_dna15};
seqan3::dna15_vector dna15_vector = "ACGT"_dna15;
seqan3::rna15_vector rna15_vector{dna15_vector.begin(), dna15_vector.end()};
}
You can avoid this copy by using std::ranges::view
s:
int main()
{
seqan3::rna15_vector vector = "ACG"_rna15;
auto dna15_view = vector | seqan3::views::convert<seqan3::dna15>;
for (auto && chr: dna15_view)
{
}
}
The 15 letter DNA alphabet, containing all IUPAC smybols minus the gap.
Definition: dna15.hpp:51
Provides seqan3::views::convert.
This conversion constructor only allows converting seqan3::dna15 to seqan3::rna15. Other alphabets that inherit from seqan3::dna15 will not be implicitly convertible to seqan3::rna15.