libstdc++
|
00001 // <forward_list> -*- C++ -*- 00002 00003 // Copyright (C) 2008-2019 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file include/forward_list 00026 * This is a Standard C++ Library header. 00027 */ 00028 00029 #ifndef _GLIBCXX_FORWARD_LIST 00030 #define _GLIBCXX_FORWARD_LIST 1 00031 00032 #pragma GCC system_header 00033 00034 #if __cplusplus < 201103L 00035 # include <bits/c++0x_warning.h> 00036 #else 00037 00038 #include <bits/forward_list.h> 00039 #include <bits/range_access.h> 00040 #include <bits/forward_list.tcc> 00041 00042 #ifdef _GLIBCXX_DEBUG 00043 # include <debug/forward_list> 00044 #endif 00045 00046 #ifdef _GLIBCXX_PROFILE 00047 # include <profile/forward_list> 00048 #endif 00049 00050 #if __cplusplus >= 201703L 00051 namespace std _GLIBCXX_VISIBILITY(default) 00052 { 00053 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00054 namespace pmr 00055 { 00056 template<typename _Tp> class polymorphic_allocator; 00057 template<typename _Tp> 00058 using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>; 00059 } // namespace pmr 00060 _GLIBCXX_END_NAMESPACE_VERSION 00061 } // namespace std 00062 #endif // C++17 00063 00064 #if __cplusplus > 201703L 00065 namespace std _GLIBCXX_VISIBILITY(default) 00066 { 00067 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00068 00069 #define __cpp_lib_erase_if 201900L 00070 00071 template<typename _Tp, typename _Alloc, typename _Predicate> 00072 inline typename forward_list<_Tp, _Alloc>::size_type 00073 erase_if(forward_list<_Tp, _Alloc>& __cont, _Predicate __pred) 00074 { return __cont.remove_if(__pred); } 00075 00076 template<typename _Tp, typename _Alloc, typename _Up> 00077 inline typename forward_list<_Tp, _Alloc>::size_type 00078 erase(forward_list<_Tp, _Alloc>& __cont, const _Up& __value) 00079 { 00080 using __elem_type = typename forward_list<_Tp, _Alloc>::value_type; 00081 return std::erase_if(__cont, [&](__elem_type& __elem) { 00082 return __elem == __value; 00083 }); 00084 } 00085 _GLIBCXX_END_NAMESPACE_VERSION 00086 } // namespace std 00087 #endif // C++20 00088 00089 #endif // C++11 00090 00091 #endif // _GLIBCXX_FORWARD_LIST