Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:29

0001 // Boost.Geometry Index
0002 //
0003 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
0004 //
0005 // Use, modification and distribution is subject to the Boost Software License,
0006 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_NTH_ELEMENT_HPP
0010 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_NTH_ELEMENT_HPP
0011 
0012 #include <algorithm>
0013 
0014 namespace boost { namespace geometry { namespace index { namespace detail {
0015 
0016 // See https://svn.boost.org/trac/boost/ticket/12861
0017 //     https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800
0018 //     https://gcc.gnu.org/develop.html#timeline
0019 // 20120920 4.7.2 - no bug
0020 // 20130322 4.8.0 - no bug
0021 // 20130411 4.7.3 - no bug
0022 // 20130531 4.8.1 - no bug
0023 // 20131016 4.8.2 - bug
0024 // 20140422 4.9.0 - fixed
0025 // 20140522 4.8.3 - fixed
0026 // 20140612 4.7.4 - fixed
0027 // 20140716 4.9.1 - fixed
0028 #if defined(__GLIBCXX__) && (__GLIBCXX__ == 20131016)
0029 
0030 #warning "std::nth_element replaced with std::sort, libstdc++ bug workaround.";
0031 
0032 template <typename RandomIt>
0033 void nth_element(RandomIt first, RandomIt , RandomIt last)
0034 {
0035     std::sort(first, last);
0036 }
0037 
0038 template <typename RandomIt, typename Compare>
0039 void nth_element(RandomIt first, RandomIt , RandomIt last, Compare comp)
0040 {
0041     std::sort(first, last, comp);
0042 }
0043 
0044 #else
0045 
0046 template <typename RandomIt>
0047 void nth_element(RandomIt first, RandomIt nth, RandomIt last)
0048 {
0049     std::nth_element(first, nth, last);
0050 }
0051 
0052 template <typename RandomIt, typename Compare>
0053 void nth_element(RandomIt first, RandomIt nth, RandomIt last, Compare comp)
0054 {
0055     std::nth_element(first, nth, last, comp);
0056 }
0057 
0058 #endif
0059 
0060 }}}} // namespace boost::geometry::index::detail
0061 
0062 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_NTH_ELEMENT_HPP