Skip to content

axes should provide strong exception guarantee for metadata #379

@HDembinski

Description

@HDembinski

template <class It, class = detail::requires_iterator<It>> 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 #372 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions