Feature #15587
Please add a fhicl::Comment(std::string) constructor
Description
Concatenating the comment from strings, like in
fhicl::Comment("Atomic numbers; allowed values are " + std::to_string(Z_xenon) + " and " + std::to_string(Z_argon) + ".")
currently requires to go through a c_str()
call, and makes the user (me) wonder if the destruction of the temporary string will cause havoc.(I eventually read the code: it doesn't)
A
Comment(std::string)
constructor moving the string into the comment object would be welcome.
Associated revisions
Resolve issue #15587: support conversion of std::string to fhicl::Comment.
History
#1 Updated by Kyle Knoepfel almost 4 years ago
- Status changed from New to Assigned
- Assignee set to Kyle Knoepfel
- Estimated time set to 1.00 h
This should be straightforward to implement.
#2 Updated by Kyle Knoepfel almost 4 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Somewhat non-trivial to implement due to overload ambiguities, but it was achieved through a layer of indirection, which is invisible to the user.
Implemented with commit fhicl-cpp:2711923.
#3 Updated by Kyle Knoepfel almost 4 years ago
- Status changed from Resolved to Closed
- Target version set to 2.06.03
Resolve issue #15587: support conversion of std::string to fhicl::Comment.