SourceXtractorPlusPlus
0.12
Please provide a description of the project.
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::VariantCast
To VariantCast(const From &from)
Definition:
VariantCast.h:37
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::VariantCastVisitor
Definition:
VariantCast.h:28
SourceXtractor::VariantCastVisitor::operator()
To operator()(const From &from) const
Definition:
VariantCast.h:31
Generated by
1.8.14