LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Comment.h
Go to the documentation of this file.
1
#ifndef fhiclcpp_types_Comment_h
2
#define fhiclcpp_types_Comment_h
3
4
// There are two ways to initialize a fhicl::Comment:
5
//
6
// fhicl::Comment{"Hello world."} ==> Argument is char const*
7
// fhicl::Comment{std::to_string(47)} ==> Argument is std::string
8
//
9
// Technical comments:
10
//
11
// Specifying a Comment constructor that takes an std::string can
12
// yield ambiguities for Sequence objects, which support
13
// initialization with default values via an std::initializer_list.
14
// To get around this issue, a layer of indirection is added to the
15
// Comment c'tor--the comment_detail::ArgWrapper, which supports
16
// implicit conversion of a 'char const*' or 'std::string' argument
17
// to itself. The extra layer introduces an additional conversion
18
// required for a Sequence object, making it disfavored in overload
19
// resolution.
20
21
#include <string>
22
23
namespace
fhicl
{
24
25
namespace
comment_detail {
26
struct
ArgWrapper
{
27
ArgWrapper
(
char
const
* arg) :
value
{arg} {}
28
ArgWrapper
(std::string
const
& arg) :
value
{arg} {}
29
std::string
value
;
30
};
31
}
32
33
struct
Comment
{
34
explicit
Comment
(
comment_detail::ArgWrapper
const
& wrapper)
35
:
value
{wrapper.
value
}
36
{}
37
std::string
value
;
38
};
39
}
40
41
#endif
/* fhiclcpp_types_Comment_h */
42
43
// Local variables:
44
// mode: c++
45
// End:
fhicl::comment_detail::ArgWrapper
Definition:
Comment.h:26
fhicl::comment_detail::ArgWrapper::ArgWrapper
ArgWrapper(std::string const &arg)
Definition:
Comment.h:28
fhicl::comment_detail::ArgWrapper::ArgWrapper
ArgWrapper(char const *arg)
Definition:
Comment.h:27
fhicl
parameter set interface
Definition:
ServiceProviderWrappers.h:37
fhicl::Comment::Comment
Comment(comment_detail::ArgWrapper const &wrapper)
Definition:
Comment.h:34
fhicl::comment_detail::ArgWrapper::value
std::string value
Definition:
Comment.h:29
fhicl::Comment::value
std::string value
Definition:
Comment.h:37
fhicl::Comment
Definition:
Comment.h:33
fhiclcpp
types
Comment.h
Generated on Wed Dec 12 2018 14:42:36 for LArSoft by
1.8.11