/usr/include/boost/compute/detail
Edit: /usr/include/boost/compute/detail/is_contiguous_iterator.hpp (3720B)
//---------------------------------------------------------------------------//
// 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_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP
#define BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP
#include
#include
#include
#include
#include
namespace boost {
namespace compute {
namespace detail {
// default = false
template
struct _is_contiguous_iterator : public boost::false_type {};
// std::vector::iterator = true
template
struct _is_contiguous_iterator<
Iterator,
typename boost::enable_if<
typename boost::is_same<
Iterator,
typename std::vector::iterator
>::type
>::type
> : public boost::true_type {};
// std::vector::const_iterator = true
template
struct _is_contiguous_iterator<
Iterator,
typename boost::enable_if<
typename boost::is_same<
Iterator,
typename std::vector::const_iterator
>::type
>::type
> : public boost::true_type {};
// std::valarray::iterator = true
template
struct _is_contiguous_iterator<
Iterator,
typename boost::enable_if<
typename boost::is_same<
Iterator,
typename std::valarray::iterator
>::type
>::type
> : public boost::true_type {};
// std::valarray::const_iterator = true
template
struct _is_contiguous_iterator<
Iterator,
typename boost::enable_if<
typename boost::is_same<
Iterator,
typename std::valarray::const_iterator
>::type
>::type
> : public boost::true_type {};
// T* = true
template
struct _is_contiguous_iterator<
Iterator,
typename boost::enable_if<
boost::is_pointer
>::type
> : public boost::true_type {};
// the is_contiguous_iterator meta-function returns true if Iterator points
// to a range of contiguous values. examples of contiguous iterators are
// std::vector<>::iterator and float*. examples of non-contiguous iterators
// are std::set<>::iterator and std::insert_iterator<>.
//
// the implementation consists of two phases. the first checks that value_type
// for the iterator is not void. this must be done as for many containers void
// is not a valid value_type (ex. std::vector::iterator is not valid).
// after ensuring a non-void value_type, the _is_contiguous_iterator function
// is invoked. it has specializations retuning true for all (known) contiguous
// iterators types and a default value of false.
template
struct is_contiguous_iterator :
public _is_contiguous_iterator<
typename boost::remove_cv::type
> {};
// value_type of void = false
template
struct is_contiguous_iterator<
Iterator,
typename boost::enable_if<
typename boost::is_void<
typename Iterator::value_type
>::type
>::type
> : public boost::false_type {};
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_DETAIL_IS_CONTIGUOUS_ITERATOR_HPP