/usr/include/boost/compute/functional
Edit: /usr/include/boost/compute/functional/get.hpp (1883B)
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_FUNCTIONAL_GET_HPP
#define BOOST_COMPUTE_FUNCTIONAL_GET_HPP
#include
#include
#include
namespace boost {
namespace compute {
namespace detail {
// meta-function returning the result type for get()
template
struct get_result_type
{
typedef typename scalar_type::type type;
};
template
struct invoked_get
{
typedef typename get_result_type::type result_type;
invoked_get(const Arg &arg)
: m_arg(arg)
{
}
Arg m_arg;
};
} // end detail namespace
/// Returns the \c N'th element of an aggregate type (e.g. scalarN,
/// pair, tuple, etc.).
///
/// \see \ref field "field"
template
struct get
{
/// \internal_
template struct result;
/// \internal_
template
struct result
{
typedef typename detail::get_result_type::type type;
};
template
detail::invoked_get<
N, Arg, typename boost::remove_cv::type
> operator()(const Arg &arg) const
{
typedef typename boost::remove_cv::type T;
return detail::invoked_get(arg);
}
};
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_FUNCTIONAL_GET_HPP