Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:04:53

0001 /*
0002   Copyright 2008 Intel Corporation
0003 
0004   Use, modification and distribution are subject to the Boost Software License,
0005   Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006   http://www.boost.org/LICENSE_1_0.txt).
0007 */
0008 #ifndef BOOST_POLYGON_SORT_ADAPTOR_HPP
0009 #define BOOST_POLYGON_SORT_ADAPTOR_HPP
0010 #ifdef __ICC
0011 #pragma warning(disable:2022)
0012 #pragma warning(disable:2023)
0013 #endif
0014 
0015 #include <algorithm>
0016 
0017 //! @brief polygon_sort_adaptor default implementation that calls std::sort
0018 namespace boost {
0019   namespace polygon {
0020 
0021     template<typename iterator_type>
0022     struct dummy_to_delay_instantiation{
0023       typedef int unit_type; // default GTL unit
0024     };
0025 
0026     //! @brief polygon_sort_adaptor default implementation that calls std::sort
0027     template<typename T>
0028     struct polygon_sort_adaptor {
0029       //! @brief wrapper that mimics std::sort() function and takes
0030       // the same arguments
0031       template<typename RandomAccessIterator_Type>
0032       static void sort(RandomAccessIterator_Type _First,
0033                        RandomAccessIterator_Type _Last)
0034       {
0035          std::sort(_First, _Last);
0036       }
0037       //! @brief wrapper that mimics std::sort() function overload and takes
0038       // the same arguments
0039       template<typename RandomAccessIterator_Type, typename Pred_Type>
0040       static void sort(RandomAccessIterator_Type _First,
0041                        RandomAccessIterator_Type _Last,
0042                        const Pred_Type& _Comp)
0043       {
0044          std::sort(_First, _Last, _Comp);
0045       }
0046     };
0047 
0048     //! @brief user level wrapper for sorting quantities
0049     template <typename iter_type>
0050     void polygon_sort(iter_type _b_, iter_type _e_)
0051     {
0052       polygon_sort_adaptor<typename dummy_to_delay_instantiation<iter_type>::unit_type>::sort(_b_, _e_);
0053     }
0054 
0055     //! @brief user level wrapper for sorting quantities that takes predicate
0056     // as additional argument
0057     template <typename iter_type, typename pred_type>
0058     void polygon_sort(iter_type _b_, iter_type _e_, const pred_type& _pred_)
0059     {
0060       polygon_sort_adaptor<typename dummy_to_delay_instantiation<iter_type>::unit_type>::sort(_b_, _e_, _pred_);
0061     }
0062 
0063 
0064 
0065   } // namespace polygon
0066 }   // namespace boost
0067 #endif