Skip to content
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] Add to_chars overload for floating points. #1160

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

smehringer
Copy link
Member

No description provided.

@smehringer smehringer requested a review from eseiler July 5, 2019 11:19
@codecov
Copy link

codecov bot commented Jul 5, 2019

Codecov Report

Merging #1160 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1160   +/-   ##
=======================================
  Coverage   96.36%   96.36%           
=======================================
  Files         201      201           
  Lines        7782     7782           
=======================================
  Hits         7499     7499           
  Misses        283      283

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 633eba7...ee0a184. Read the comment docs.

@smehringer smehringer requested a review from joergi-w July 8, 2019 08:28
Copy link
Member

@joergi-w joergi-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I have just two questions where things are not clear to me:

include/seqan3/std/charconv Outdated Show resolved Hide resolved
include/seqan3/std/charconv Outdated Show resolved Hide resolved
Copy link
Member

@joergi-w joergi-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@smehringer smehringer requested a review from rrahn July 8, 2019 13:26
@smehringer
Copy link
Member Author

@rrahn kind review ping :) this is a tiny PR that I would like to get in ASAP as another one depends on it.

Copy link
Contributor

@rrahn rrahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor things

template <seqan3::FloatingPoint floating_point_type>
inline std::to_chars_result to_chars(char * first, char * last, floating_point_type value) noexcept
{
std::ostringstream ss;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please assert that both ptr values are not nullptr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in 2 separate asserts so you can see by the line number which one failed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine 🙄

test/unit/std/charconv_test.cpp Show resolved Hide resolved
{
TypeParam val{120};
char buffer[10];

// buffer.clear();
[[maybe_unused]] auto res = std::to_chars(&buffer[0], &buffer[0] + sizeof(buffer), val);
auto res = std::to_chars(&buffer[0], &buffer[0] + sizeof(buffer), val);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using std::array instead since it would be the c++ way.

test/unit/std/charconv_test.cpp Outdated Show resolved Hide resolved
template <seqan3::FloatingPoint floating_point_type>
inline std::to_chars_result to_chars(char * first, char * last, floating_point_type value) noexcept
{
std::ostringstream ss;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in 2 separate asserts so you can see by the line number which one failed.

test/unit/std/charconv_test.cpp Show resolved Hide resolved
test/unit/std/charconv_test.cpp Outdated Show resolved Hide resolved
test/unit/std/charconv_test.cpp Outdated Show resolved Hide resolved
test/unit/std/charconv_test.cpp Outdated Show resolved Hide resolved
@rrahn rrahn merged commit 069aa26 into seqan:master Jul 11, 2019
Module: std automation moved this from ⏳ In Progress to 🍻 Done Jul 11, 2019
@smehringer smehringer deleted the charconv branch July 12, 2019 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Module: std
  
🍻 Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants