/* * Copyright 2008-2012 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #define __THRUST_DEFINE_HAS_MEMBER_FUNCTION(trait_name, member_function_name) \ template class trait_name; \ \ template \ class trait_name \ { \ class yes { char m; }; \ class no { yes m[2]; }; \ struct base_mixin \ { \ Result member_function_name(); \ }; \ struct base : public T, public base_mixin {}; \ template class helper{}; \ template \ static no deduce(U*, helper* = 0); \ static yes deduce(...); \ public: \ static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ typedef thrust::detail::integral_constant type; \ }; \ \ template \ class trait_name \ { \ class yes { char m; }; \ class no { yes m[2]; }; \ struct base_mixin \ { \ Result member_function_name(Arg); \ }; \ struct base : public T, public base_mixin {}; \ template class helper{}; \ template \ static no deduce(U*, helper* = 0); \ static yes deduce(...); \ public: \ static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ typedef thrust::detail::integral_constant type; \ }; \ \ template \ class trait_name \ { \ class yes { char m; }; \ class no { yes m[2]; }; \ struct base_mixin \ { \ Result member_function_name(Arg1,Arg2); \ }; \ struct base : public T, public base_mixin {}; \ template class helper{}; \ template \ static no deduce(U*, helper* = 0); \ static yes deduce(...); \ public: \ static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ typedef thrust::detail::integral_constant type; \ }; \ \ template \ class trait_name \ { \ class yes { char m; }; \ class no { yes m[2]; }; \ struct base_mixin \ { \ Result member_function_name(Arg1,Arg2,Arg3); \ }; \ struct base : public T, public base_mixin {}; \ template class helper{}; \ template \ static no deduce(U*, helper* = 0); \ static yes deduce(...); \ public: \ static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ typedef thrust::detail::integral_constant type; \ }; \ \ template \ class trait_name \ { \ class yes { char m; }; \ class no { yes m[2]; }; \ struct base_mixin \ { \ Result member_function_name(Arg1,Arg2,Arg3,Arg4); \ }; \ struct base : public T, public base_mixin {}; \ template class helper{}; \ template \ static no deduce(U*, helper* = 0); \ static yes deduce(...); \ public: \ static const bool value = sizeof(yes) == sizeof(deduce(static_cast(0))); \ typedef thrust::detail::integral_constant type; \ };