]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
11 | #ifndef BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP | |
12 | #define BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP | |
13 | ||
14 | #include <boost/utility/result_of.hpp> | |
15 | ||
16 | namespace boost { | |
17 | namespace compute { | |
18 | ||
19 | /// Returns the result of \c Function when called with \c Args. | |
20 | /// | |
21 | /// For example, | |
22 | /// \code | |
23 | /// // int + int = int | |
24 | /// result_of<plus(int, int)>::type == int | |
25 | /// \endcode | |
26 | template<class Signature> | |
27 | struct result_of | |
28 | { | |
29 | // the default implementation uses the TR1-style result_of protocol. note | |
30 | // that we explicitly do *not* use the C++11 decltype operator as we want | |
31 | // the result type as it would be on an OpenCL device, not the actual C++ | |
32 | // type resulting from "invoking" the function on the host. | |
33 | typedef typename ::boost::tr1_result_of<Signature>::type type; | |
34 | }; | |
35 | ||
36 | } // end compute namespace | |
37 | } // end boost namespace | |
38 | ||
39 | #endif // BOOST_COMPUTE_TYPE_TRAITS_RESULT_OF_HPP |