9#include <boost/mpl/and.hpp>
10#include <boost/python/detail/prefix.hpp>
11#include <boost/python/to_python_value.hpp>
19namespace PythonInterface {
31template <
typename ReturnType,
typename InputType>
struct AsTypeImpl {
33 inline PyObject *operator()(
const InputType &p)
const {
35 return to_python_value<ReturnType>()(ReturnType(p));
38 inline PyTypeObject
const *get_pytype()
const {
40 return converter::registered<ReturnType>::converters.to_python_target_type();
47template <
typename T>
struct AsType_Requires_New_Type_Automatically_Convertible_To_Original {};
54template <
class ReturnType>
struct AsType {
55 template <
class InputType>
struct apply {
59 typename boost::mpl::if_c<std::is_convertible<InputType, ReturnType>::value, AsTypeImpl<ReturnType, InputType>,
60 AsType_Requires_New_Type_Automatically_Convertible_To_Original<InputType>>
::type;
Helper class which provides the Collimation Length for SANS instruments.
typename boost::mpl::if_c< std::is_convertible< InputType, ReturnType >::value, AsTypeImpl< ReturnType, InputType >, AsType_Requires_New_Type_Automatically_Convertible_To_Original< InputType > >::type type
Implements the AsType policy.