SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEUtils
SEUtils
VariantCast.h
Go to the documentation of this file.
1
18
#ifndef _SEUTILS_VARIANTCAST_H_
19
#define _SEUTILS_VARIANTCAST_H_
20
21
#include <boost/lexical_cast.hpp>
22
#include <boost/variant/static_visitor.hpp>
23
#include <boost/variant/apply_visitor.hpp>
24
25
namespace
SourceXtractor
{
26
27
template
<
typename
To>
28
class
VariantCastVisitor
:
public
boost::static_visitor<To> {
29
public
:
30
template
<
typename
From>
31
To
operator()
(
const
From
&
from
)
const
{
32
return
boost::lexical_cast<To>(
from
);
33
}
34
};
35
36
template
<
typename
To,
typename
From>
37
To
VariantCast
(
const
From
&
from
) {
38
return
boost::apply_visitor(
VariantCastVisitor<To>
(),
from
);
39
}
40
41
}
// end of namespace SourceXtractor
42
43
#endif
/* _SEUTILS_VARIANTCAST_H_ */
SourceXtractor::VariantCastVisitor
Definition
VariantCast.h:28
SourceXtractor::VariantCastVisitor::operator()
To operator()(const From &from) const
Definition
VariantCast.h:31
std::function
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::VariantCast
To VariantCast(const From &from)
Definition
VariantCast.h:37
Generated by
1.10.0