boostorg / boostorg/histogram

axes should provide strong exception guarantee for metadata

Open
#379 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
334
Forks
76
PR merge metrics
No merged PRs in 30d

Description

`template > variable(It begin, It end, metadata_type meta = {}, options_type options = {}, allocator_type alloc = {})` does not provide strong exception guarantee: if user writes `variable(it_begin, it_end, std::move(str))` and constructor body throws then the value inside `str` is lost (the value was moved into parameter and then data member before the exception). So one can not write `while(std::cin>>str>>...){ try{ variable(..., ..., str); ... }catch(...){} }` and has to take on the burden of saving the `str` elsewhere (so the user do not have to type it again) when other constructor arguments might be illegal and have to be typed again.

_Originally posted by @jhcarl0814 in https://github.com/boostorg/histogram/issues/372#issuecomment-1364386000_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.