diff --git a/thrust/iterator/constant_iterator.h b/thrust/iterator/constant_iterator.h index 344389c3e..cda852918 100644 --- a/thrust/iterator/constant_iterator.h +++ b/thrust/iterator/constant_iterator.h @@ -71,7 +71,7 @@ namespace thrust * #include * #include * - * int main(void) + * int main() * { * thrust::device_vector data(4); * data[0] = 3; @@ -117,8 +117,8 @@ template * #include * - * int main(void) + * int main() * { * // this example computes indices for all the nonzero values in a sequence * @@ -149,7 +149,7 @@ templatebase_reference(); } diff --git a/thrust/iterator/detail/any_assign.h b/thrust/iterator/detail/any_assign.h index 27f438260..4e7f2cf20 100644 --- a/thrust/iterator/detail/any_assign.h +++ b/thrust/iterator/detail/any_assign.h @@ -27,7 +27,7 @@ namespace detail // a type which may be assigned any other type struct any_assign { - inline __host__ __device__ any_assign(void) + inline __host__ __device__ any_assign() {} template diff --git a/thrust/iterator/detail/counting_iterator.inl b/thrust/iterator/detail/counting_iterator.inl index 6289fee36..abcd87989 100644 --- a/thrust/iterator/detail/counting_iterator.inl +++ b/thrust/iterator/detail/counting_iterator.inl @@ -69,7 +69,7 @@ template , // self Incrementable, // Base diff --git a/thrust/iterator/detail/join_iterator.h b/thrust/iterator/detail/join_iterator.h index c38828040..21aaa8e53 100644 --- a/thrust/iterator/detail/join_iterator.h +++ b/thrust/iterator/detail/join_iterator.h @@ -100,6 +100,10 @@ class join_iterator private: friend class thrust::iterator_core_access; + // MSVC 2013 and 2015 incorrectly warning about returning a reference to + // a local/temporary here. + // See goo.gl/LELTNp + __THRUST_DISABLE_MSVC_WARNING_BEGIN(4172) __host__ __device__ typename super_t::reference dereference() const @@ -108,6 +112,8 @@ class join_iterator return (i < m_n1) ? m_iter1[i] : static_cast(m_iter2[i]); } // end dereference() + __THRUST_DISABLE_MSVC_WARNING_END(4172) + size_type m_n1; RandomAccessIterator1 m_iter1; diff --git a/thrust/iterator/detail/reverse_iterator.inl b/thrust/iterator/detail/reverse_iterator.inl index f5aa07aeb..5eb9ac5ff 100644 --- a/thrust/iterator/detail/reverse_iterator.inl +++ b/thrust/iterator/detail/reverse_iterator.inl @@ -64,7 +64,7 @@ template __host__ __device__ typename reverse_iterator::super_t::reference reverse_iterator - ::dereference(void) const + ::dereference() const { return *thrust::detail::prior(this->base()); } // end reverse_iterator::increment() @@ -72,7 +72,7 @@ template template __host__ __device__ void reverse_iterator - ::increment(void) + ::increment() { --this->base_reference(); } // end reverse_iterator::increment() @@ -80,7 +80,7 @@ template template __host__ __device__ void reverse_iterator - ::decrement(void) + ::decrement() { ++this->base_reference(); } // end reverse_iterator::decrement() diff --git a/thrust/iterator/detail/tagged_iterator.h b/thrust/iterator/detail/tagged_iterator.h index b7f6fa32b..da5cb4c47 100644 --- a/thrust/iterator/detail/tagged_iterator.h +++ b/thrust/iterator/detail/tagged_iterator.h @@ -51,7 +51,7 @@ template public: __host__ __device__ - tagged_iterator(void) {} + tagged_iterator() {} __host__ __device__ explicit tagged_iterator(Iterator x) diff --git a/thrust/iterator/detail/zip_iterator.inl b/thrust/iterator/detail/zip_iterator.inl index d5e65431d..7eb35b091 100644 --- a/thrust/iterator/detail/zip_iterator.inl +++ b/thrust/iterator/detail/zip_iterator.inl @@ -26,7 +26,7 @@ namespace thrust template __host__ __device__ zip_iterator - ::zip_iterator(void) + ::zip_iterator() { } // end zip_iterator::zip_iterator() @@ -57,7 +57,7 @@ template template __host__ __device__ const IteratorTuple &zip_iterator - ::get_iterator_tuple(void) const + ::get_iterator_tuple() const { return m_iterator_tuple; } // end zip_iterator::get_iterator_tuple() @@ -67,11 +67,13 @@ template typename zip_iterator::super_t::reference __host__ __device__ zip_iterator - ::dereference(void) const + ::dereference() const { using namespace detail::tuple_impl_specific; - return thrust::detail::tuple_host_device_transform(get_iterator_tuple(), detail::dereference_iterator()); + return thrust::detail::tuple_host_device_transform< + detail::dereference_iterator::template apply + >(get_iterator_tuple(), detail::dereference_iterator()); } // end zip_iterator::dereference() @@ -100,7 +102,7 @@ __host__ __device__ template __host__ __device__ void zip_iterator - ::increment(void) + ::increment() { using namespace detail::tuple_impl_specific; tuple_for_each(m_iterator_tuple, detail::increment_iterator()); @@ -110,7 +112,7 @@ __host__ __device__ template __host__ __device__ void zip_iterator - ::decrement(void) + ::decrement() { using namespace detail::tuple_impl_specific; tuple_for_each(m_iterator_tuple, detail::decrement_iterator()); diff --git a/thrust/iterator/discard_iterator.h b/thrust/iterator/discard_iterator.h index 7e7ffc5d4..64060a9f2 100644 --- a/thrust/iterator/discard_iterator.h +++ b/thrust/iterator/discard_iterator.h @@ -53,7 +53,7 @@ namespace thrust * #include * #include * - * int main(void) + * int main() * { * thrust::device_vector keys(7), values(7); * @@ -132,7 +132,7 @@ template private: // Core iterator interface __host__ __device__ - reference dereference(void) const + reference dereference() const { return m_element; } diff --git a/thrust/iterator/permutation_iterator.h b/thrust/iterator/permutation_iterator.h index 27555ddd0..0f72d9631 100644 --- a/thrust/iterator/permutation_iterator.h +++ b/thrust/iterator/permutation_iterator.h @@ -167,6 +167,11 @@ template base()); } + __THRUST_DISABLE_MSVC_WARNING_END(4172) + // make friends for the copy constructor template friend class permutation_iterator; diff --git a/thrust/iterator/reverse_iterator.h b/thrust/iterator/reverse_iterator.h index 7509d860a..2ba97d0ac 100644 --- a/thrust/iterator/reverse_iterator.h +++ b/thrust/iterator/reverse_iterator.h @@ -160,7 +160,7 @@ template /*! Default constructor does nothing. */ __host__ __device__ - reverse_iterator(void) {} + reverse_iterator() {} /*! \p Constructor accepts a \c BidirectionalIterator pointing to a range * for this \p reverse_iterator to reverse. @@ -195,13 +195,13 @@ template private: __thrust_exec_check_disable__ __host__ __device__ - typename super_t::reference dereference(void) const; + typename super_t::reference dereference() const; __host__ __device__ - void increment(void); + void increment(); __host__ __device__ - void decrement(void); + void decrement(); __host__ __device__ void advance(typename super_t::difference_type n); diff --git a/thrust/iterator/transform_iterator.h b/thrust/iterator/transform_iterator.h index bac004845..b58ed39a9 100644 --- a/thrust/iterator/transform_iterator.h +++ b/thrust/iterator/transform_iterator.h @@ -77,7 +77,7 @@ namespace thrust * } * }; * - * int main(void) + * int main() * { * thrust::device_vector v(4); * v[0] = 1.0f; @@ -120,7 +120,7 @@ namespace thrust * } * }; * - * int main(void) + * int main() * { * // initialize a device array * thrust::device_vector v(4); @@ -161,7 +161,7 @@ namespace thrust * } * }; * - * int main(void) + * int main() * { * thrust::device_vector v(4); * v[0] = 1.0f; @@ -296,16 +296,24 @@ template ::type x = *this->base(); return m_f(x); } + __THRUST_DISABLE_MSVC_WARNING_END(4172) + // tag this as mutable per Dave Abrahams in this thread: // http://lists.boost.org/Archives/boost/2004/05/65332.php mutable AdaptableUnaryFunction m_f; diff --git a/thrust/iterator/transform_output_iterator.h b/thrust/iterator/transform_output_iterator.h index 88a16b06e..0550d75f1 100644 --- a/thrust/iterator/transform_output_iterator.h +++ b/thrust/iterator/transform_output_iterator.h @@ -63,7 +63,7 @@ namespace thrust * } * }; * - * int main(void) + * int main() * { * thrust::device_vector v(4); * @@ -125,7 +125,9 @@ template __host__ __device__ typename super_t::reference dereference() const { - return detail::transform_output_iterator_proxy(this->base_reference(), fun); + return detail::transform_output_iterator_proxy< + UnaryFunction, OutputIterator + >(this->base_reference(), fun); } UnaryFunction fun; diff --git a/thrust/iterator/zip_iterator.h b/thrust/iterator/zip_iterator.h index 76ba5870b..df2d845fd 100644 --- a/thrust/iterator/zip_iterator.h +++ b/thrust/iterator/zip_iterator.h @@ -108,7 +108,7 @@ namespace thrust * #include * #include * - * int main(void) + * int main() * { * thrust::device_vector int_in(3), int_out(3); * int_in[0] = 0; @@ -144,7 +144,7 @@ template /*! Null constructor does nothing. */ inline __host__ __device__ - zip_iterator(void); + zip_iterator(); /*! This constructor creates a new \p zip_iterator from a * \p tuple of iterators.