Project

General

Profile

Feature #15587

Please add a fhicl::Comment(std::string) constructor

Added by Gianluca Petrillo over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
Target version:
Start date:
02/18/2017
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:
Duration:

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

Revision 27119237 (diff)
Added by Kyle Knoepfel over 2 years ago

Resolve issue #15587: support conversion of std::string to fhicl::Comment.

Revision 6e048512 (diff)
Added by Kyle Knoepfel over 2 years ago

Resolve issue #15587: support conversion of std::string to fhicl::Comment.

History

#1 Updated by Kyle Knoepfel over 2 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 over 2 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 over 2 years ago

  • Status changed from Resolved to Closed
  • Target version set to 2.06.03


Also available in: Atom PDF