libstdc++
|
00001 // <list> -*- C++ -*- 00002 00003 // Copyright (C) 2001-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 /* 00026 * 00027 * Copyright (c) 1994 00028 * Hewlett-Packard Company 00029 * 00030 * Permission to use, copy, modify, distribute and sell this software 00031 * and its documentation for any purpose is hereby granted without fee, 00032 * provided that the above copyright notice appear in all copies and 00033 * that both that copyright notice and this permission notice appear 00034 * in supporting documentation. Hewlett-Packard Company makes no 00035 * representations about the suitability of this software for any 00036 * purpose. It is provided "as is" without express or implied warranty. 00037 * 00038 * 00039 * Copyright (c) 1996,1997 00040 * Silicon Graphics Computer Systems, Inc. 00041 * 00042 * Permission to use, copy, modify, distribute and sell this software 00043 * and its documentation for any purpose is hereby granted without fee, 00044 * provided that the above copyright notice appear in all copies and 00045 * that both that copyright notice and this permission notice appear 00046 * in supporting documentation. Silicon Graphics makes no 00047 * representations about the suitability of this software for any 00048 * purpose. It is provided "as is" without express or implied warranty. 00049 */ 00050 00051 /** @file include/list 00052 * This is a Standard C++ Library header. 00053 */ 00054 00055 #ifndef _GLIBCXX_LIST 00056 #define _GLIBCXX_LIST 1 00057 00058 #pragma GCC system_header 00059 00060 #include <bits/stl_algobase.h> 00061 #include <bits/allocator.h> 00062 #include <bits/range_access.h> 00063 #include <bits/stl_list.h> 00064 #include <bits/list.tcc> 00065 00066 #ifdef _GLIBCXX_DEBUG 00067 # include <debug/list> 00068 #endif 00069 00070 #ifdef _GLIBCXX_PROFILE 00071 # include <profile/list> 00072 #endif 00073 00074 #if __cplusplus >= 201703L 00075 namespace std _GLIBCXX_VISIBILITY(default) 00076 { 00077 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00078 namespace pmr 00079 { 00080 template<typename _Tp> class polymorphic_allocator; 00081 template<typename _Tp> 00082 using list = std::list<_Tp, polymorphic_allocator<_Tp>>; 00083 } // namespace pmr 00084 _GLIBCXX_END_NAMESPACE_VERSION 00085 } // namespace std 00086 #endif // C++17 00087 00088 #if __cplusplus > 201703L 00089 namespace std _GLIBCXX_VISIBILITY(default) 00090 { 00091 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00092 00093 #define __cpp_lib_erase_if 201900L 00094 00095 template<typename _Tp, typename _Alloc, typename _Predicate> 00096 inline typename list<_Tp, _Alloc>::size_type 00097 erase_if(list<_Tp, _Alloc>& __cont, _Predicate __pred) 00098 { return __cont.remove_if(__pred); } 00099 00100 template<typename _Tp, typename _Alloc, typename _Up> 00101 inline typename list<_Tp, _Alloc>::size_type 00102 erase(list<_Tp, _Alloc>& __cont, const _Up& __value) 00103 { 00104 using __elem_type = typename list<_Tp, _Alloc>::value_type; 00105 return std::erase_if(__cont, [&](__elem_type& __elem) { 00106 return __elem == __value; 00107 }); 00108 } 00109 _GLIBCXX_END_NAMESPACE_VERSION 00110 } // namespace std 00111 #endif // C++20 00112 00113 #endif /* _GLIBCXX_LIST */