278a728906
<boost/parameter/parameters.hpp>: * Add preprocessor conditional statement to prevent generation of ill-formed function call operator overloads. "test/maybe.cpp" "test/singular.cpp" "test/tutorial.cpp" "test/sfinae.cpp" "test/earwicker.cpp" * Replace BOOST_PARAMETER_KEYWORD statements with BOOST_PARAMETER_NAME statements. "test/optional_deduced_sfinae.cpp" "test/normalized_argument_types.cpp" "test/literate/*.cpp" * Use Boost.Core.LightweightTest where int main() is available. * Replace assert statements with BOOST_TEST_EQ statements. "test/basics.hpp" * Remove preprocessor statements regarding borland, gcc-2, and msvc workarounds. "test/ntp.cpp" "test/sfinae.cpp" "test/earwicker.cpp" "test/normalized_argument_types.cpp" "test/basics.hpp" * Add preprocessor conditional statement to #error out if BOOST_PARAMETER_MAX_ARITY is set to an insufficient value. "test/basics.cpp" "test/deduced.cpp" "test/macros.cpp" "test/preprocessor.cpp" "test/preprocessor_deduced.cpp" * Replace S and char const* expressions with boost::container::string expressions. * Uncomment any code that fails to compile, but add preprocessor conditional statement so that test suites can incorporate compile-fail statements regarding the code in question. * Ensure that int main() returns boost::process_errors(). "test/literate/deduced-template-parameters0.cpp": "test/literate/exercising-the-code-so-far0.cpp": * Enclose BOOST_MPL_ASSERT statements within MPL_TEST_CASE block. "test/literate/defining-the-keywords1.cpp": * Add graphs::tag::graph::qualifier type definition because perfect forwarding code will check for it. * Replace deprecated keyword::get() invocation with keyword::instance invocation. test/Jamfile.v2: * Add modifier <define>BOOST_PARAMETER_MAX_ARITY=# to run, run-fail, compile, and compile-fail statements to conserve compiler memory usage on GitHub's side. * Add modifier <preserve-target-tests>off to run and run-fail statements to conserve executable space on GitHub's side. * Separate bpl-test statement into its own target, parameter_python_test, which fails on xcode8.3 as well as on mingw and msvc compilers with address-model=64. * The next commit (which will implement perfect forwarding) will subsume test/literate/Jamfile.v2 into this file. Strangely enough, attempting to do so now will result in compiler errors. .travis.yml: * Add g++-4.7, g++-4.8, g++-4.9, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, xcode7.3, and xcode8.3 compiler configurations. * Split compiler configurations by available CXXSTD values. (This will keep the job times within limits for the next commit.) * Ensure that the xcode8.3 compiler configurations exclude parameter_python_test from the test suite. appveyor.yml: * Add compiler configurations that support address-model=64 to the test matrix. * Ensure that the new configurations exclude parameter_python_test from the test suite.
194 lines
4.8 KiB
C++
194 lines
4.8 KiB
C++
|
|
#include <boost/parameter.hpp>
|
|
|
|
namespace boost { namespace python {
|
|
|
|
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
|
|
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
|
|
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
|
|
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
|
|
|
|
template <typename B = int>
|
|
struct bases
|
|
{
|
|
};
|
|
}}
|
|
|
|
#include <boost/mpl/bool.hpp>
|
|
#include <boost/mpl/placeholders.hpp>
|
|
#include <boost/mpl/if.hpp>
|
|
#include <boost/mpl/is_sequence.hpp>
|
|
#include <boost/type_traits/is_class.hpp>
|
|
#include <boost/config.hpp>
|
|
|
|
#if !defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) || \
|
|
!(1 == BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
|
|
#include <boost/type_traits/is_scalar.hpp>
|
|
#endif
|
|
|
|
namespace boost { namespace python {
|
|
|
|
typedef boost::parameter::parameters<
|
|
boost::parameter::required<
|
|
tag::class_type
|
|
#if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION) && \
|
|
(1 == BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
|
|
, boost::mpl::if_<
|
|
boost::is_class<boost::mpl::_>
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>
|
|
#else
|
|
, boost::mpl::if_<
|
|
boost::is_scalar<boost::mpl::_>
|
|
, boost::mpl::false_
|
|
, boost::mpl::true_
|
|
>
|
|
#endif
|
|
>
|
|
, boost::parameter::optional<
|
|
tag::base_list
|
|
, boost::mpl::is_sequence<boost::mpl::_>
|
|
>
|
|
, boost::parameter::optional<tag::held_type>
|
|
, boost::parameter::optional<tag::copyable>
|
|
> class_signature;
|
|
}} // namespace boost::python
|
|
|
|
namespace boost { namespace python {
|
|
|
|
template <
|
|
typename A0
|
|
, typename A1 = boost::parameter::void_
|
|
, typename A2 = boost::parameter::void_
|
|
, typename A3 = boost::parameter::void_
|
|
>
|
|
struct class_
|
|
{
|
|
// Create ArgumentPack
|
|
typedef typename class_signature::BOOST_NESTED_TEMPLATE bind<
|
|
A0, A1, A2, A3
|
|
>::type args;
|
|
|
|
// Extract first logical parameter.
|
|
typedef typename boost::parameter::value_type<
|
|
args, tag::class_type
|
|
>::type class_type;
|
|
|
|
typedef typename boost::parameter::value_type<
|
|
args, tag::base_list, boost::python::bases<>
|
|
>::type base_list;
|
|
|
|
typedef typename boost::parameter::value_type<
|
|
args, tag::held_type, class_type
|
|
>::type held_type;
|
|
|
|
typedef typename boost::parameter::value_type<
|
|
args, tag::copyable, void
|
|
>::type copyable;
|
|
};
|
|
}} // namespace boost::python
|
|
|
|
struct B
|
|
{
|
|
};
|
|
|
|
struct D
|
|
{
|
|
};
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
#include <memory>
|
|
|
|
typedef boost::python::class_<
|
|
boost::python::class_type<B>
|
|
, boost::python::copyable<boost::noncopyable>
|
|
> c1;
|
|
|
|
typedef boost::python::class_<
|
|
D
|
|
, boost::python::held_type<
|
|
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
|
std::auto_ptr<D>
|
|
#else
|
|
std::unique_ptr<D>
|
|
#endif
|
|
>
|
|
, boost::python::base_list<boost::python::bases<B> >
|
|
> c2;
|
|
|
|
#include <boost/type_traits/is_same.hpp>
|
|
#include <boost/mpl/aux_/test.hpp>
|
|
#include <boost/mpl/assert.hpp>
|
|
|
|
MPL_TEST_CASE()
|
|
{
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c1::class_type,B>
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c1::base_list,boost::python::bases<> >
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c1::held_type,B>
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c1::copyable,boost::noncopyable>
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c2::class_type,D>
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c2::base_list,boost::python::bases<B> >
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
#if defined(BOOST_NO_CXX11_SMART_PTR)
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c2::held_type,std::auto_ptr<D> >
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
#else
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c2::held_type,std::unique_ptr<D> >
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
#endif // BOOST_NO_CXX11_SMART_PTR
|
|
BOOST_MPL_ASSERT((
|
|
boost::mpl::if_<
|
|
boost::is_same<c2::copyable,void>
|
|
, boost::mpl::true_
|
|
, boost::mpl::false_
|
|
>::type
|
|
));
|
|
}
|
|
|