/* * Copyright 2008-2012 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #include #include #include namespace thrust { namespace detail { // this trait reports what type should be used as a temporary in certain algorithms // which aggregate intermediate results from a function before writing to an output iterator // the pseudocode for deducing the type of the temporary used below: // // if Function is an AdaptableFunction // result = Function::result_type // else if OutputIterator2 is a "pure" output iterator // result = InputIterator2::value_type // else // result = OutputIterator2::value_type // // XXX upon c++0x, TemporaryType needs to be: // result_of::type template struct intermediate_type_from_function_and_iterators : eval_if< has_result_type::value, result_type, eval_if< is_output_iterator::value, thrust::iterator_value, thrust::iterator_value > > { }; // end intermediate_type_from_function_and_iterators } // end detail } // end thrust