/*! @file @copyright Barrett Adair 2015 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #include #include #include #include #ifndef CT_ASSERT #define CT_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__) #endif //CT_ASSERT #ifdef _MSC_VER //abominable function type warning #pragma warning(disable:4180) #endif namespace ct = callable_traits; using Input = int; using Output = float; void test(); template< typename DecayedInput, typename Output, typename Input, typename Expect, template class Metafunction > void test_expand() { using input = typename Metafunction::type; using test = typename Metafunction::type; using decorator = ct::decorator; using result1 = ct::decorate_like; using result2 = typename decorator::template apply; CT_ASSERT(std::is_same{}); CT_ASSERT(std::is_same{}); CT_ASSERT(std::is_same, DecayedInput>{}); } template struct identity { using type = T; }; template struct wrap_ref { using type = std::reference_wrapper; }; template struct wrap_unique { using type = std::unique_ptr; }; template struct wrap_shared { using type = std::shared_ptr; }; template struct wrap_weak { using type = std::weak_ptr; }; struct foo {}; template struct add_member_pointer { using type = T foo::*; }; template void test_prepare() { test_expand(); test_expand(); test_expand(); test_expand(); test_expand(); test_expand(); test_expand(); test_expand(); test_expand(); test_expand(); } template void test() { test_prepare(); test_prepare(); test_prepare(); test_prepare, std::unique_ptr>(); test_prepare, std::shared_ptr>(); test_prepare, std::weak_ptr>(); test_prepare&, std::unique_ptr&>(); test_prepare&, std::shared_ptr&>(); test_prepare&&, std::weak_ptr&&>(); test_prepare*, std::unique_ptr*>(); test_prepare*, std::shared_ptr*>(); test_prepare*, std::weak_ptr*>(); test_prepare(); test_prepare(); test_prepare(); test_prepare(); test_prepare(); test_prepare(); test_prepare, const std::unique_ptr>(); test_prepare, std::shared_ptr>(); test_prepare, std::weak_ptr>(); test_prepare&, std::unique_ptr&>(); } int main() { test(); test(); test(); test(); test(); test(); test(); return 0; }