result_of.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
  3. //
  4. // Distributed under the Boost Software License, Version 1.0
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. //
  8. // See http://boostorg.github.com/compute for more information.
  9. //---------------------------------------------------------------------------//
  10. #ifndef BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP
  11. #define BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP
  12. #include <boost/utility/result_of.hpp>
  13. namespace boost {
  14. namespace compute {
  15. /// Returns the result of \c Function when called with \c Args.
  16. ///
  17. /// For example,
  18. /// \code
  19. /// // int + int = int
  20. /// result_of<plus(int, int)>::type == int
  21. /// \endcode
  22. template<class Signature>
  23. struct result_of
  24. {
  25. // the default implementation uses the TR1-style result_of protocol. note
  26. // that we explicitly do *not* use the C++11 decltype operator as we want
  27. // the result type as it would be on an OpenCL device, not the actual C++
  28. // type resulting from "invoking" the function on the host.
  29. typedef typename ::boost::tr1_result_of<Signature>::type type;
  30. };
  31. } // end compute namespace
  32. } // end boost namespace
  33. #endif // BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP