-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] cigar.assign_string from char pointers. #2966
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## master #2966 +/- ##
=======================================
Coverage 98.20% 98.21%
=======================================
Files 274 274
Lines 12216 12216
=======================================
+ Hits 11997 11998 +1
+ Misses 219 218 -1
Continue to review full report at Codecov.
|
In C++23 we could do with a single overload that accepts cigar & assign_string(std::string_view const s) // not noexcept, should throw on problem
{
// implementation
}
template <std::ranges::contiguous_range rng_t>
requires (std::ranges::sized_range<rng_t> && std::same_as<char, std::ranges::range_value_t<rng_t>>)
cigar & assign_string(rng_t && s)
{
return assign_string(std::string_view{std::ranges::data(s), std::ranges::size(s)});
} I don't know why there should be an overload for |
.
|
6f528db
to
474d587
Compare
/*!\brief Assign from a contigous char array. | ||
* \details | ||
* \experimentalapi{Experimental since version 3.1.} | ||
* | ||
* In order to avoid unnecessary copies, you can initialise a seqan3::cigar from two char pointers that point to a | ||
* contigous char array that stores the cigar string. | ||
* | ||
* \include test/snippet/alphabet/cigar/cigar_assign_string.cpp | ||
* | ||
* \attention If the cigar count cannot be correctly read, `0P` is added instead to the cigar string. | ||
* Adding 0 padding is not impacting the alignment that the cigar string represents but | ||
* keeps the number of cigar elements consistent with the input. | ||
* | ||
* \experimentalapi{Experimental since version 3.2.} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs an update (still refers to two char const *
)
My use case is the following:
From an input file stream (a SAM file) I want to construct a
std::vector<seqan3::cigar>
from a given cigar string e.g.3M
. The current overloadseqan3::cigar::assign_string(seqan3::small_string s)
would copy the string into asmall_string
before reading it and converting it to a respective letter ofseqan3::cigar
. This is an unnecessary copy. We can avoid this by providing an overload withconst char *
.