Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:00

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_FUNCTIONAL_AS_HPP
0012 #define BOOST_COMPUTE_FUNCTIONAL_AS_HPP
0013 
0014 namespace boost {
0015 namespace compute {
0016 namespace detail {
0017 
0018 template<class T, class Arg>
0019 struct invoked_as
0020 {
0021     invoked_as(const Arg &arg)
0022         : m_arg(arg)
0023     {
0024     }
0025 
0026     Arg m_arg;
0027 };
0028 
0029 } // end detail namespace
0030 
0031 /// The \ref as function converts its argument to type \c T (similar to
0032 /// reinterpret_cast<T>).
0033 ///
0034 /// \see \ref convert "convert<T>"
0035 template<class T>
0036 struct as
0037 {
0038     typedef T result_type;
0039 
0040     /// \internal_
0041     template<class Arg>
0042     detail::invoked_as<T, Arg> operator()(const Arg &arg) const
0043     {
0044         return detail::invoked_as<T, Arg>(arg);
0045     }
0046 };
0047 
0048 } // end compute namespace
0049 } // end boost namespace
0050 
0051 #endif // BOOST_COMPUTE_FUNCTIONAL_AS_HPP