Makefile.am (std_headers): Remove cXXX from list.
2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (std_headers): Remove cXXX from list.
(c_base_srcdir): No bits subdirectory.
(c_base_builddir): Same.
(c_base_headers): Adjust names, add ciso646.
(bits_headers): Remove std_xxx.h headers.
* include/Makefile.in: Regenerate.
* include/ext/iterator: Adjust includes.
* include/ext/ropeimpl.h: Same.
* include/ext/stl_hash_fun.h: Same.
* include/ext/algorithm: Same.
* include/backward/bvector.h: Adjust includes.
* include/backward/vector.h: Same.
* include/backward/strstream: Same.
* include/backward/streambuf.h: Same.
* include/backward/stack.h: Same.
* include/backward/set.h: Same.
* include/backward/queue.h: Same.
* include/backward/multiset.h: Same.
* include/backward/multimap.h: Same.
* include/backward/map.h: Same.
* include/backward/list.h: Same.
* include/backward/iterator.h: Same.
* include/backward/iostream.h: Same.
* include/backward/iomanip.h: Same.
* include/backward/fstream.h: Same.
* include/backward/deque.h: Same.
* include/backward/complex.h: Same.
* include/bits/std_algorithm.h: Move to...
* include/std/algorithm: ...here.
* include/bits/std_iosfwd.h, std_locale.h, std_stack.h,
std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h,
std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h,
std_deque.h, std_istream.h, std_numeric.h, std_string.h,
std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h,
std_queue.h, std_valarray.h, std_functional.h, std_limits.h,
std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h:
Same.
* include/c_std/bits/std_cassert.h: Move to...
* include/c_std/cassert: Here.
* include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c_std/cmath: Adjust cmath.tcc include.
* include/c_std/cstdlib: Adjust includes.
* include/c_std/cwchar: Same.
* include/c_std/ctime: Same.
* include/c_std/cstring: Same.
* include/c_std/cstdio: Same.
* include/c_std/bits: Remove directory.
* include/c/bits/std_cassert.h: Move to...
* include/c/cassert: Here.
* include/c/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c/bits: Remove directory.
* include/std/cwctype: Remove.
* include/std/cwchar: Remove.
* include/std/ctime: Remove.
* include/std/cstring: Remove.
* include/std/cstdlib: Remove.
* include/std/cstdio: Remove.
* include/std/cstddef: Remove.
* include/std/cstdarg: Remove.
* include/std/csignal: Remove.
* include/std/csetjmp: Remove.
* include/std/cmath: Remove.
* include/std/clocale: Remove.
* include/std/climits: Remove.
* include/std/ciso646: Remove.
* include/std/cfloat: Remove.
* include/std/cerrno: Remove.
* include/std/cctype: Remove.
* include/std/cassert: Remove.
* include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h>
files and subsituting <.xxx>
* include/bits/valarray_array.h: Same.
* include/bits/stl_uninitialized.h: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/stl_algobase.h: Same.
* include/bits/sstream.tcc: Same.
* include/bits/pthread_allocimpl.h: Same.
* include/bits/ostream.tcc: Same.
* include/bits/localefwd.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/bits/locale_facets.h: Same.
* include/bits/istream.tcc: Same.
* include/bits/char_traits.h: Same.
* include/bits/boost_concept_check.h: Same.
* include/bits/basic_file.h: Same.
* include/std/bitset: Same.
* include/std/complex: Same.
* include/std/fstream: Same.
* include/std/functional: Same.
* include/std/ios: Same.
* include/std/iostream: Same.
* include/std/ostream: Same.
* include/std/sstream: Same.
* include/std/streambuf: Same.
* include/std/string: Same.
* include/std/iterator: Same.
* include/std/valarray: Same.
* src/ios.cc: Adjust includes.
* src/valarray-inst.cc: Same.
* src/string-inst.cc: Same.
* src/stl-inst.cc: Same.
* src/stdexcept.cc: Same.
* src/misc-inst.cc: Same.
* src/localename.cc: Same.
* src/locale-inst.cc: Same.
* src/locale.cc: Same.
* src/limits.cc: Same.
* src/concept-inst.cc: Same.
* src/complex_io.cc: Same.
* src/codecvt.cc: Same.
* src/bitset.cc: Same.
* src/cmath.cc: Same.
From-SVN: r48544
2002-01-04 22:27:36 +01:00
|
|
|
// <functional> -*- C++ -*-
|
2001-06-09 01:22:26 +02:00
|
|
|
|
2018-01-03 11:03:58 +01:00
|
|
|
// Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
2001-06-09 01:22:26 +02:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2001-06-09 01:22:26 +02:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
2001-06-09 01:22:26 +02:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2001-06-09 01:22:26 +02:00
|
|
|
|
Makefile.am (std_headers): Remove cXXX from list.
2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (std_headers): Remove cXXX from list.
(c_base_srcdir): No bits subdirectory.
(c_base_builddir): Same.
(c_base_headers): Adjust names, add ciso646.
(bits_headers): Remove std_xxx.h headers.
* include/Makefile.in: Regenerate.
* include/ext/iterator: Adjust includes.
* include/ext/ropeimpl.h: Same.
* include/ext/stl_hash_fun.h: Same.
* include/ext/algorithm: Same.
* include/backward/bvector.h: Adjust includes.
* include/backward/vector.h: Same.
* include/backward/strstream: Same.
* include/backward/streambuf.h: Same.
* include/backward/stack.h: Same.
* include/backward/set.h: Same.
* include/backward/queue.h: Same.
* include/backward/multiset.h: Same.
* include/backward/multimap.h: Same.
* include/backward/map.h: Same.
* include/backward/list.h: Same.
* include/backward/iterator.h: Same.
* include/backward/iostream.h: Same.
* include/backward/iomanip.h: Same.
* include/backward/fstream.h: Same.
* include/backward/deque.h: Same.
* include/backward/complex.h: Same.
* include/bits/std_algorithm.h: Move to...
* include/std/algorithm: ...here.
* include/bits/std_iosfwd.h, std_locale.h, std_stack.h,
std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h,
std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h,
std_deque.h, std_istream.h, std_numeric.h, std_string.h,
std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h,
std_queue.h, std_valarray.h, std_functional.h, std_limits.h,
std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h:
Same.
* include/c_std/bits/std_cassert.h: Move to...
* include/c_std/cassert: Here.
* include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c_std/cmath: Adjust cmath.tcc include.
* include/c_std/cstdlib: Adjust includes.
* include/c_std/cwchar: Same.
* include/c_std/ctime: Same.
* include/c_std/cstring: Same.
* include/c_std/cstdio: Same.
* include/c_std/bits: Remove directory.
* include/c/bits/std_cassert.h: Move to...
* include/c/cassert: Here.
* include/c/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c/bits: Remove directory.
* include/std/cwctype: Remove.
* include/std/cwchar: Remove.
* include/std/ctime: Remove.
* include/std/cstring: Remove.
* include/std/cstdlib: Remove.
* include/std/cstdio: Remove.
* include/std/cstddef: Remove.
* include/std/cstdarg: Remove.
* include/std/csignal: Remove.
* include/std/csetjmp: Remove.
* include/std/cmath: Remove.
* include/std/clocale: Remove.
* include/std/climits: Remove.
* include/std/ciso646: Remove.
* include/std/cfloat: Remove.
* include/std/cerrno: Remove.
* include/std/cctype: Remove.
* include/std/cassert: Remove.
* include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h>
files and subsituting <.xxx>
* include/bits/valarray_array.h: Same.
* include/bits/stl_uninitialized.h: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/stl_algobase.h: Same.
* include/bits/sstream.tcc: Same.
* include/bits/pthread_allocimpl.h: Same.
* include/bits/ostream.tcc: Same.
* include/bits/localefwd.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/bits/locale_facets.h: Same.
* include/bits/istream.tcc: Same.
* include/bits/char_traits.h: Same.
* include/bits/boost_concept_check.h: Same.
* include/bits/basic_file.h: Same.
* include/std/bitset: Same.
* include/std/complex: Same.
* include/std/fstream: Same.
* include/std/functional: Same.
* include/std/ios: Same.
* include/std/iostream: Same.
* include/std/ostream: Same.
* include/std/sstream: Same.
* include/std/streambuf: Same.
* include/std/string: Same.
* include/std/iterator: Same.
* include/std/valarray: Same.
* src/ios.cc: Adjust includes.
* src/valarray-inst.cc: Same.
* src/string-inst.cc: Same.
* src/stl-inst.cc: Same.
* src/stdexcept.cc: Same.
* src/misc-inst.cc: Same.
* src/localename.cc: Same.
* src/locale-inst.cc: Same.
* src/locale.cc: Same.
* src/limits.cc: Same.
* src/concept-inst.cc: Same.
* src/complex_io.cc: Same.
* src/codecvt.cc: Same.
* src/bitset.cc: Same.
* src/cmath.cc: Same.
From-SVN: r48544
2002-01-04 22:27:36 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1997
|
|
|
|
* Silicon Graphics Computer Systems, Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Silicon Graphics makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-12-06 00:24:07 +01:00
|
|
|
/** @file include/functional
|
2004-11-24 05:11:23 +01:00
|
|
|
* This is a Standard C++ Library header.
|
2001-09-28 00:44:24 +02:00
|
|
|
*/
|
|
|
|
|
2003-07-23 17:28:44 +02:00
|
|
|
#ifndef _GLIBCXX_FUNCTIONAL
|
|
|
|
#define _GLIBCXX_FUNCTIONAL 1
|
Makefile.am (std_headers): Remove cXXX from list.
2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (std_headers): Remove cXXX from list.
(c_base_srcdir): No bits subdirectory.
(c_base_builddir): Same.
(c_base_headers): Adjust names, add ciso646.
(bits_headers): Remove std_xxx.h headers.
* include/Makefile.in: Regenerate.
* include/ext/iterator: Adjust includes.
* include/ext/ropeimpl.h: Same.
* include/ext/stl_hash_fun.h: Same.
* include/ext/algorithm: Same.
* include/backward/bvector.h: Adjust includes.
* include/backward/vector.h: Same.
* include/backward/strstream: Same.
* include/backward/streambuf.h: Same.
* include/backward/stack.h: Same.
* include/backward/set.h: Same.
* include/backward/queue.h: Same.
* include/backward/multiset.h: Same.
* include/backward/multimap.h: Same.
* include/backward/map.h: Same.
* include/backward/list.h: Same.
* include/backward/iterator.h: Same.
* include/backward/iostream.h: Same.
* include/backward/iomanip.h: Same.
* include/backward/fstream.h: Same.
* include/backward/deque.h: Same.
* include/backward/complex.h: Same.
* include/bits/std_algorithm.h: Move to...
* include/std/algorithm: ...here.
* include/bits/std_iosfwd.h, std_locale.h, std_stack.h,
std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h,
std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h,
std_deque.h, std_istream.h, std_numeric.h, std_string.h,
std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h,
std_queue.h, std_valarray.h, std_functional.h, std_limits.h,
std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h:
Same.
* include/c_std/bits/std_cassert.h: Move to...
* include/c_std/cassert: Here.
* include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c_std/cmath: Adjust cmath.tcc include.
* include/c_std/cstdlib: Adjust includes.
* include/c_std/cwchar: Same.
* include/c_std/ctime: Same.
* include/c_std/cstring: Same.
* include/c_std/cstdio: Same.
* include/c_std/bits: Remove directory.
* include/c/bits/std_cassert.h: Move to...
* include/c/cassert: Here.
* include/c/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c/bits: Remove directory.
* include/std/cwctype: Remove.
* include/std/cwchar: Remove.
* include/std/ctime: Remove.
* include/std/cstring: Remove.
* include/std/cstdlib: Remove.
* include/std/cstdio: Remove.
* include/std/cstddef: Remove.
* include/std/cstdarg: Remove.
* include/std/csignal: Remove.
* include/std/csetjmp: Remove.
* include/std/cmath: Remove.
* include/std/clocale: Remove.
* include/std/climits: Remove.
* include/std/ciso646: Remove.
* include/std/cfloat: Remove.
* include/std/cerrno: Remove.
* include/std/cctype: Remove.
* include/std/cassert: Remove.
* include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h>
files and subsituting <.xxx>
* include/bits/valarray_array.h: Same.
* include/bits/stl_uninitialized.h: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/stl_algobase.h: Same.
* include/bits/sstream.tcc: Same.
* include/bits/pthread_allocimpl.h: Same.
* include/bits/ostream.tcc: Same.
* include/bits/localefwd.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/bits/locale_facets.h: Same.
* include/bits/istream.tcc: Same.
* include/bits/char_traits.h: Same.
* include/bits/boost_concept_check.h: Same.
* include/bits/basic_file.h: Same.
* include/std/bitset: Same.
* include/std/complex: Same.
* include/std/fstream: Same.
* include/std/functional: Same.
* include/std/ios: Same.
* include/std/iostream: Same.
* include/std/ostream: Same.
* include/std/sstream: Same.
* include/std/streambuf: Same.
* include/std/string: Same.
* include/std/iterator: Same.
* include/std/valarray: Same.
* src/ios.cc: Adjust includes.
* src/valarray-inst.cc: Same.
* src/string-inst.cc: Same.
* src/stl-inst.cc: Same.
* src/stdexcept.cc: Same.
* src/misc-inst.cc: Same.
* src/localename.cc: Same.
* src/locale-inst.cc: Same.
* src/locale.cc: Same.
* src/limits.cc: Same.
* src/concept-inst.cc: Same.
* src/complex_io.cc: Same.
* src/codecvt.cc: Same.
* src/bitset.cc: Same.
* src/cmath.cc: Same.
From-SVN: r48544
2002-01-04 22:27:36 +01:00
|
|
|
|
|
|
|
#pragma GCC system_header
|
2003-11-11 21:09:16 +01:00
|
|
|
|
Makefile.am (std_headers): Remove cXXX from list.
2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (std_headers): Remove cXXX from list.
(c_base_srcdir): No bits subdirectory.
(c_base_builddir): Same.
(c_base_headers): Adjust names, add ciso646.
(bits_headers): Remove std_xxx.h headers.
* include/Makefile.in: Regenerate.
* include/ext/iterator: Adjust includes.
* include/ext/ropeimpl.h: Same.
* include/ext/stl_hash_fun.h: Same.
* include/ext/algorithm: Same.
* include/backward/bvector.h: Adjust includes.
* include/backward/vector.h: Same.
* include/backward/strstream: Same.
* include/backward/streambuf.h: Same.
* include/backward/stack.h: Same.
* include/backward/set.h: Same.
* include/backward/queue.h: Same.
* include/backward/multiset.h: Same.
* include/backward/multimap.h: Same.
* include/backward/map.h: Same.
* include/backward/list.h: Same.
* include/backward/iterator.h: Same.
* include/backward/iostream.h: Same.
* include/backward/iomanip.h: Same.
* include/backward/fstream.h: Same.
* include/backward/deque.h: Same.
* include/backward/complex.h: Same.
* include/bits/std_algorithm.h: Move to...
* include/std/algorithm: ...here.
* include/bits/std_iosfwd.h, std_locale.h, std_stack.h,
std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h,
std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h,
std_deque.h, std_istream.h, std_numeric.h, std_string.h,
std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h,
std_queue.h, std_valarray.h, std_functional.h, std_limits.h,
std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h:
Same.
* include/c_std/bits/std_cassert.h: Move to...
* include/c_std/cassert: Here.
* include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c_std/cmath: Adjust cmath.tcc include.
* include/c_std/cstdlib: Adjust includes.
* include/c_std/cwchar: Same.
* include/c_std/ctime: Same.
* include/c_std/cstring: Same.
* include/c_std/cstdio: Same.
* include/c_std/bits: Remove directory.
* include/c/bits/std_cassert.h: Move to...
* include/c/cassert: Here.
* include/c/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c/bits: Remove directory.
* include/std/cwctype: Remove.
* include/std/cwchar: Remove.
* include/std/ctime: Remove.
* include/std/cstring: Remove.
* include/std/cstdlib: Remove.
* include/std/cstdio: Remove.
* include/std/cstddef: Remove.
* include/std/cstdarg: Remove.
* include/std/csignal: Remove.
* include/std/csetjmp: Remove.
* include/std/cmath: Remove.
* include/std/clocale: Remove.
* include/std/climits: Remove.
* include/std/ciso646: Remove.
* include/std/cfloat: Remove.
* include/std/cerrno: Remove.
* include/std/cctype: Remove.
* include/std/cassert: Remove.
* include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h>
files and subsituting <.xxx>
* include/bits/valarray_array.h: Same.
* include/bits/stl_uninitialized.h: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/stl_algobase.h: Same.
* include/bits/sstream.tcc: Same.
* include/bits/pthread_allocimpl.h: Same.
* include/bits/ostream.tcc: Same.
* include/bits/localefwd.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/bits/locale_facets.h: Same.
* include/bits/istream.tcc: Same.
* include/bits/char_traits.h: Same.
* include/bits/boost_concept_check.h: Same.
* include/bits/basic_file.h: Same.
* include/std/bitset: Same.
* include/std/complex: Same.
* include/std/fstream: Same.
* include/std/functional: Same.
* include/std/ios: Same.
* include/std/iostream: Same.
* include/std/ostream: Same.
* include/std/sstream: Same.
* include/std/streambuf: Same.
* include/std/string: Same.
* include/std/iterator: Same.
* include/std/valarray: Same.
* src/ios.cc: Adjust includes.
* src/valarray-inst.cc: Same.
* src/string-inst.cc: Same.
* src/stl-inst.cc: Same.
* src/stdexcept.cc: Same.
* src/misc-inst.cc: Same.
* src/localename.cc: Same.
* src/locale-inst.cc: Same.
* src/locale.cc: Same.
* src/limits.cc: Same.
* src/concept-inst.cc: Same.
* src/complex_io.cc: Same.
* src/codecvt.cc: Same.
* src/bitset.cc: Same.
* src/cmath.cc: Same.
From-SVN: r48544
2002-01-04 22:27:36 +01:00
|
|
|
#include <bits/c++config.h>
|
|
|
|
#include <bits/stl_function.h>
|
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#if __cplusplus >= 201103L
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
#include <new>
|
|
|
|
#include <tuple>
|
|
|
|
#include <type_traits>
|
|
|
|
#include <bits/functional_hash.h>
|
2016-08-06 02:06:02 +02:00
|
|
|
#include <bits/invoke.h>
|
2017-12-14 18:18:22 +01:00
|
|
|
#include <bits/refwrap.h> // std::reference_wrapper and _Mem_fn_traits
|
|
|
|
#include <bits/std_function.h> // std::function
|
2016-09-12 17:48:07 +02:00
|
|
|
#if __cplusplus > 201402L
|
Split <functional> into smaller pieces
* include/Makefile.am: Add <bits/refwrap.h> and <bits/std_function.h>.
Order alphabetically.
* include/Makefile.in: Regenerate.
* include/bits/refwrap.h: New header.
(_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
(_Reference_wrapper_base_impl, _Reference_wrapper_base)
(reference_wrapper, ref, cref): Move here from <functional>.
* include/bits/shared_ptr_base.h: Include <bits/refwrap.h> and
<bits/stl_function.h> instead of <functional>.
* include/bits/std_function.h: New header.
(_Maybe_unary_or_binary_function, bad_function_call)
(__is_location_invariant, _Nocopy_types, _Any_data)
(_Simple_type_wrapper, _Function_base, _Function_handler, function):
Move here from <functional>.
* include/bits/unique_ptr.h: Include <bits/stl_function.h>.
* include/std/functional: Include new headers and move components to
them.
* include/std/future: Include <bits/std_function.h> instead of
<functional>.
* include/std/mutex: Likewise.
* include/std/regex: Likewise.
* src/c++11/compatibility-thread-c++0x.cc: Include <functional>.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
lines.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/30_threads/packaged_task/49668.cc: Include <functional>.
From-SVN: r241410
2016-10-21 17:32:25 +02:00
|
|
|
# include <unordered_map>
|
|
|
|
# include <vector>
|
|
|
|
# include <array>
|
|
|
|
# include <utility>
|
|
|
|
# include <bits/stl_algo.h>
|
2016-09-12 17:48:07 +02:00
|
|
|
#endif
|
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
_GLIBCXX_BEGIN_NAMESPACE_VERSION
|
2010-11-02 19:51:23 +01:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
#if __cplusplus > 201402L
|
|
|
|
# define __cpp_lib_invoke 201411
|
2011-04-19 15:26:08 +02:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
/// Invoke a callable object.
|
|
|
|
template<typename _Callable, typename... _Args>
|
P0604R0 add invoke_result, is_invocable etc. for C++17
* include/bits/invoke.h (__invoke): Use __invoke_result instead of
result_of, and __is_nothrow_invocable instead of
__is_nothrow_callable.
* include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable
instead of __is_callable.
* include/std/functional (invoke): use invoke_result_t instead of
result_of_t and is_nothrow_invocable instead of is_nothrow_callable.
(_Not_fn): Use __invoke_result instead of result_of.
* include/std/type_traits (__result_of_memobj, __result_of_memfun):
Remove partial specializations for reference_wrapper types.
(__result_of_impl): Use __inv_unwrap to strip reference_wrapper.
(__invoke_result): Define replacement for result_of and then use it to
define result_of.
(__is_callable_impl, __is_callable, __is_nothrow_callable): Replace
with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable
respectively.
(invoke_result, invoke_result_t): Define for C++17.
(is_callable, is_nothrow_callable): Replace with is_invocable,
is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r.
(is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v,
is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v.
* include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v
instead of is_nothrow_callable_v.
* testsuite/20_util/function_objects/invoke/59768.cc: Remove unused
main function.
* testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable
instead of is_callable.
* testsuite/20_util/is_callable/*: Rename directory and adjust tests
to use new traits.
* testsuite/20_util/is_notjrow_callable/*: Likewise.
* testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of
is_callable.
* testsuite/20_util/variant/hash.cc: Likewise.
From-SVN: r246036
2017-03-10 16:29:38 +01:00
|
|
|
inline invoke_result_t<_Callable, _Args...>
|
2015-10-25 02:00:54 +02:00
|
|
|
invoke(_Callable&& __fn, _Args&&... __args)
|
P0604R0 add invoke_result, is_invocable etc. for C++17
* include/bits/invoke.h (__invoke): Use __invoke_result instead of
result_of, and __is_nothrow_invocable instead of
__is_nothrow_callable.
* include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable
instead of __is_callable.
* include/std/functional (invoke): use invoke_result_t instead of
result_of_t and is_nothrow_invocable instead of is_nothrow_callable.
(_Not_fn): Use __invoke_result instead of result_of.
* include/std/type_traits (__result_of_memobj, __result_of_memfun):
Remove partial specializations for reference_wrapper types.
(__result_of_impl): Use __inv_unwrap to strip reference_wrapper.
(__invoke_result): Define replacement for result_of and then use it to
define result_of.
(__is_callable_impl, __is_callable, __is_nothrow_callable): Replace
with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable
respectively.
(invoke_result, invoke_result_t): Define for C++17.
(is_callable, is_nothrow_callable): Replace with is_invocable,
is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r.
(is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v,
is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v.
* include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v
instead of is_nothrow_callable_v.
* testsuite/20_util/function_objects/invoke/59768.cc: Remove unused
main function.
* testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable
instead of is_callable.
* testsuite/20_util/is_callable/*: Rename directory and adjust tests
to use new traits.
* testsuite/20_util/is_notjrow_callable/*: Likewise.
* testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of
is_callable.
* testsuite/20_util/variant/hash.cc: Likewise.
From-SVN: r246036
2017-03-10 16:29:38 +01:00
|
|
|
noexcept(is_nothrow_invocable_v<_Callable, _Args...>)
|
2009-11-30 10:34:04 +01:00
|
|
|
{
|
2015-10-25 02:00:54 +02:00
|
|
|
return std::__invoke(std::forward<_Callable>(__fn),
|
|
|
|
std::forward<_Args>(__args)...);
|
2009-11-30 10:34:04 +01:00
|
|
|
}
|
2015-10-25 02:00:54 +02:00
|
|
|
#endif
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2014-11-03 03:55:32 +01:00
|
|
|
template<typename _MemFunPtr,
|
|
|
|
bool __is_mem_fn = is_member_function_pointer<_MemFunPtr>::value>
|
|
|
|
class _Mem_fn_base
|
|
|
|
: public _Mem_fn_traits<_MemFunPtr>::__maybe_type
|
|
|
|
{
|
|
|
|
using _Traits = _Mem_fn_traits<_MemFunPtr>;
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2014-11-12 00:38:34 +01:00
|
|
|
using _Arity = typename _Traits::__arity;
|
|
|
|
using _Varargs = typename _Traits::__vararg;
|
2012-11-28 02:42:25 +01:00
|
|
|
|
2014-11-12 00:38:34 +01:00
|
|
|
template<typename _Func, typename... _BoundArgs>
|
|
|
|
friend struct _Bind_check_arity;
|
2012-11-28 02:42:25 +01:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
_MemFunPtr _M_pmf;
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
using result_type = typename _Traits::__result_type;
|
2014-11-12 00:38:34 +01:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
explicit constexpr
|
|
|
|
_Mem_fn_base(_MemFunPtr __pmf) noexcept : _M_pmf(__pmf) { }
|
2014-11-12 00:38:34 +01:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
template<typename... _Args>
|
|
|
|
auto
|
|
|
|
operator()(_Args&&... __args) const
|
2015-12-21 14:02:12 +01:00
|
|
|
noexcept(noexcept(
|
|
|
|
std::__invoke(_M_pmf, std::forward<_Args>(__args)...)))
|
|
|
|
-> decltype(std::__invoke(_M_pmf, std::forward<_Args>(__args)...))
|
2015-10-25 02:00:54 +02:00
|
|
|
{ return std::__invoke(_M_pmf, std::forward<_Args>(__args)...); }
|
2010-10-06 19:17:16 +02:00
|
|
|
};
|
|
|
|
|
2014-11-03 03:55:32 +01:00
|
|
|
// Partial specialization for member object pointers.
|
2015-10-25 02:00:54 +02:00
|
|
|
template<typename _MemObjPtr>
|
|
|
|
class _Mem_fn_base<_MemObjPtr, false>
|
2009-11-30 10:34:04 +01:00
|
|
|
{
|
2014-11-03 03:55:36 +01:00
|
|
|
using _Arity = integral_constant<size_t, 0>;
|
2014-11-12 00:38:34 +01:00
|
|
|
using _Varargs = false_type;
|
|
|
|
|
|
|
|
template<typename _Func, typename... _BoundArgs>
|
|
|
|
friend struct _Bind_check_arity;
|
2014-11-03 03:55:36 +01:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
_MemObjPtr _M_pm;
|
|
|
|
|
2014-11-12 00:38:34 +01:00
|
|
|
public:
|
2015-05-13 15:12:48 +02:00
|
|
|
explicit constexpr
|
2015-10-25 02:00:54 +02:00
|
|
|
_Mem_fn_base(_MemObjPtr __pm) noexcept : _M_pm(__pm) { }
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2015-10-25 02:00:54 +02:00
|
|
|
template<typename _Tp>
|
2012-11-27 00:53:29 +01:00
|
|
|
auto
|
2015-10-25 02:00:54 +02:00
|
|
|
operator()(_Tp&& __obj) const
|
2015-12-21 14:02:12 +01:00
|
|
|
noexcept(noexcept(std::__invoke(_M_pm, std::forward<_Tp>(__obj))))
|
2015-10-25 02:00:54 +02:00
|
|
|
-> decltype(std::__invoke(_M_pm, std::forward<_Tp>(__obj)))
|
|
|
|
{ return std::__invoke(_M_pm, std::forward<_Tp>(__obj)); }
|
2014-11-03 03:55:32 +01:00
|
|
|
};
|
|
|
|
|
Split <functional> into smaller pieces
* include/Makefile.am: Add <bits/refwrap.h> and <bits/std_function.h>.
Order alphabetically.
* include/Makefile.in: Regenerate.
* include/bits/refwrap.h: New header.
(_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
(_Reference_wrapper_base_impl, _Reference_wrapper_base)
(reference_wrapper, ref, cref): Move here from <functional>.
* include/bits/shared_ptr_base.h: Include <bits/refwrap.h> and
<bits/stl_function.h> instead of <functional>.
* include/bits/std_function.h: New header.
(_Maybe_unary_or_binary_function, bad_function_call)
(__is_location_invariant, _Nocopy_types, _Any_data)
(_Simple_type_wrapper, _Function_base, _Function_handler, function):
Move here from <functional>.
* include/bits/unique_ptr.h: Include <bits/stl_function.h>.
* include/std/functional: Include new headers and move components to
them.
* include/std/future: Include <bits/std_function.h> instead of
<functional>.
* include/std/mutex: Likewise.
* include/std/regex: Likewise.
* src/c++11/compatibility-thread-c++0x.cc: Include <functional>.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
lines.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/30_threads/packaged_task/49668.cc: Include <functional>.
From-SVN: r241410
2016-10-21 17:32:25 +02:00
|
|
|
template<typename _MemberPointer>
|
|
|
|
struct _Mem_fn; // undefined
|
|
|
|
|
2014-11-03 03:55:32 +01:00
|
|
|
template<typename _Res, typename _Class>
|
|
|
|
struct _Mem_fn<_Res _Class::*>
|
|
|
|
: _Mem_fn_base<_Res _Class::*>
|
|
|
|
{
|
|
|
|
using _Mem_fn_base<_Res _Class::*>::_Mem_fn_base;
|
2009-11-30 10:34:04 +01:00
|
|
|
};
|
|
|
|
|
2012-11-19 23:28:00 +01:00
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 2048. Unnecessary mem_fn overloads
|
2009-11-30 10:34:04 +01:00
|
|
|
/**
|
|
|
|
* @brief Returns a function object that forwards to the member
|
|
|
|
* pointer @a pm.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup functors
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Tp, typename _Class>
|
|
|
|
inline _Mem_fn<_Tp _Class::*>
|
2012-11-27 00:53:29 +01:00
|
|
|
mem_fn(_Tp _Class::* __pm) noexcept
|
2009-11-30 10:34:04 +01:00
|
|
|
{
|
|
|
|
return _Mem_fn<_Tp _Class::*>(__pm);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-12-15 15:17:27 +01:00
|
|
|
* @brief Determines if the given type _Tp is a function object that
|
2009-11-30 10:34:04 +01:00
|
|
|
* should be treated as a subexpression when evaluating calls to
|
2015-12-15 15:17:27 +01:00
|
|
|
* function objects returned by bind().
|
|
|
|
*
|
|
|
|
* C++11 [func.bind.isbind].
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup binders
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Tp>
|
|
|
|
struct is_bind_expression
|
2010-01-26 14:33:06 +01:00
|
|
|
: public false_type { };
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Determines if the given type _Tp is a placeholder in a
|
2015-12-15 15:17:27 +01:00
|
|
|
* bind() expression and, if so, which placeholder it is.
|
|
|
|
*
|
|
|
|
* C++11 [func.bind.isplace].
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup binders
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Tp>
|
|
|
|
struct is_placeholder
|
2010-01-26 14:33:06 +01:00
|
|
|
: public integral_constant<int, 0>
|
|
|
|
{ };
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2016-07-31 16:52:53 +02:00
|
|
|
#if __cplusplus > 201402L
|
Implement P0607R0 "Inline Variables for Standard Library" for C++17
2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com>
* include/bits/c++config (_GLIBCXX17_INLINE): Define.
* include/bits/regex_constants.h (All std::regex_constants constants):
Add _GLIBCXX17_INLINE as per P0607R0.
* include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock):
Likewise.
* include/bits/stl_pair.h (piecewise_construct): Likewise.
* include/bits/uses_allocator.h (allocator_arg, uses_allocator_v)
(__is_uses_allocator_constructible_v)
(__is_nothrow_uses_allocator_constructible_v): Likewise.
* include/std/chrono (treat_as_floating_point_v): Likewise.
* include/std/functional (is_bind_expression_v, is_placeholder_v):
Likewise.
* include/std/optional (nullopt): Likewise.
* include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v)
ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise.
* include/std/system_error (is_error_code_enum_v)
(is_error_condition_enum_v): Likewise.
* include/std/tuple (tuple_size_v, ignore): Likewise.
(ignore): Declare ignore constexpr as per LWG 2773, declare assignment
constexpr as per LWG 2933.
* include/std/type_traits (All variable templates): Add
_GLIBCXX17_INLINE as per P0607R0.
* include/std/variant (variant_size_v, variant_npos, __index_of_v)
(__tuple_count_v, __exactly_once): Likewise.
* testsuite/18_support/headers/new/synopsis.cc
(hardware_destructive_interference_size)
(hardware_constructive_interference_size): Likewise for commented-out
variables.
* testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new
test function for constexpr std::ignore (LWG 2773).
* testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New
test for LWG 2933.
From-SVN: r246423
2017-03-23 20:40:07 +01:00
|
|
|
template <typename _Tp> inline constexpr bool is_bind_expression_v
|
2016-07-31 16:52:53 +02:00
|
|
|
= is_bind_expression<_Tp>::value;
|
Implement P0607R0 "Inline Variables for Standard Library" for C++17
2017-03-23 Daniel Kruegler <daniel.kruegler@gmail.com>
* include/bits/c++config (_GLIBCXX17_INLINE): Define.
* include/bits/regex_constants.h (All std::regex_constants constants):
Add _GLIBCXX17_INLINE as per P0607R0.
* include/bits/std_mutex.h (defer_lock, try_to_lock, adopt_lock):
Likewise.
* include/bits/stl_pair.h (piecewise_construct): Likewise.
* include/bits/uses_allocator.h (allocator_arg, uses_allocator_v)
(__is_uses_allocator_constructible_v)
(__is_nothrow_uses_allocator_constructible_v): Likewise.
* include/std/chrono (treat_as_floating_point_v): Likewise.
* include/std/functional (is_bind_expression_v, is_placeholder_v):
Likewise.
* include/std/optional (nullopt): Likewise.
* include/std/ratio (ratio_equal_v, ratio_not_equal_v, ratio_less_v)
ratio_less_equal_v, ratio_greater_v, ratio_greater_equal_v): Likewise.
* include/std/system_error (is_error_code_enum_v)
(is_error_condition_enum_v): Likewise.
* include/std/tuple (tuple_size_v, ignore): Likewise.
(ignore): Declare ignore constexpr as per LWG 2773, declare assignment
constexpr as per LWG 2933.
* include/std/type_traits (All variable templates): Add
_GLIBCXX17_INLINE as per P0607R0.
* include/std/variant (variant_size_v, variant_npos, __index_of_v)
(__tuple_count_v, __exactly_once): Likewise.
* testsuite/18_support/headers/new/synopsis.cc
(hardware_destructive_interference_size)
(hardware_constructive_interference_size): Likewise for commented-out
variables.
* testsuite/20_util/tuple/creation_functions/constexpr.cc: Add new
test function for constexpr std::ignore (LWG 2773).
* testsuite/20_util/tuple/creation_functions/constexpr_cpp14.cc: New
test for LWG 2933.
From-SVN: r246423
2017-03-23 20:40:07 +01:00
|
|
|
template <typename _Tp> inline constexpr int is_placeholder_v
|
2016-07-31 16:52:53 +02:00
|
|
|
= is_placeholder<_Tp>::value;
|
|
|
|
#endif // C++17
|
|
|
|
|
2011-11-22 01:40:47 +01:00
|
|
|
/** @brief The type of placeholder objects defined by libstdc++.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
2009-11-30 10:34:04 +01:00
|
|
|
template<int _Num> struct _Placeholder { };
|
|
|
|
|
|
|
|
/** @namespace std::placeholders
|
2011-11-22 01:40:47 +01:00
|
|
|
* @brief ISO C++11 entities sub-namespace for functional.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup binders
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
2011-03-15 01:24:08 +01:00
|
|
|
namespace placeholders
|
2011-01-06 11:14:37 +01:00
|
|
|
{
|
2011-11-22 01:40:47 +01:00
|
|
|
/* Define a large number of placeholders. There is no way to
|
|
|
|
* simplify this with variadic templates, because we're introducing
|
|
|
|
* unique names for each.
|
|
|
|
*/
|
2011-01-06 11:14:37 +01:00
|
|
|
extern const _Placeholder<1> _1;
|
|
|
|
extern const _Placeholder<2> _2;
|
|
|
|
extern const _Placeholder<3> _3;
|
|
|
|
extern const _Placeholder<4> _4;
|
|
|
|
extern const _Placeholder<5> _5;
|
|
|
|
extern const _Placeholder<6> _6;
|
|
|
|
extern const _Placeholder<7> _7;
|
|
|
|
extern const _Placeholder<8> _8;
|
|
|
|
extern const _Placeholder<9> _9;
|
|
|
|
extern const _Placeholder<10> _10;
|
|
|
|
extern const _Placeholder<11> _11;
|
|
|
|
extern const _Placeholder<12> _12;
|
|
|
|
extern const _Placeholder<13> _13;
|
|
|
|
extern const _Placeholder<14> _14;
|
|
|
|
extern const _Placeholder<15> _15;
|
|
|
|
extern const _Placeholder<16> _16;
|
|
|
|
extern const _Placeholder<17> _17;
|
|
|
|
extern const _Placeholder<18> _18;
|
|
|
|
extern const _Placeholder<19> _19;
|
|
|
|
extern const _Placeholder<20> _20;
|
|
|
|
extern const _Placeholder<21> _21;
|
|
|
|
extern const _Placeholder<22> _22;
|
|
|
|
extern const _Placeholder<23> _23;
|
|
|
|
extern const _Placeholder<24> _24;
|
|
|
|
extern const _Placeholder<25> _25;
|
|
|
|
extern const _Placeholder<26> _26;
|
|
|
|
extern const _Placeholder<27> _27;
|
|
|
|
extern const _Placeholder<28> _28;
|
|
|
|
extern const _Placeholder<29> _29;
|
2009-11-30 10:34:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Partial specialization of is_placeholder that provides the placeholder
|
|
|
|
* number for the placeholder objects defined by libstdc++.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup binders
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<int _Num>
|
|
|
|
struct is_placeholder<_Placeholder<_Num> >
|
2010-01-26 14:33:06 +01:00
|
|
|
: public integral_constant<int, _Num>
|
|
|
|
{ };
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2011-11-22 01:40:47 +01:00
|
|
|
template<int _Num>
|
|
|
|
struct is_placeholder<const _Placeholder<_Num> >
|
|
|
|
: public integral_constant<int, _Num>
|
|
|
|
{ };
|
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2015-12-15 15:17:27 +01:00
|
|
|
// Like tuple_element_t but SFINAE-friendly.
|
2016-07-31 19:08:52 +02:00
|
|
|
template<std::size_t __i, typename _Tuple>
|
|
|
|
using _Safe_tuple_element_t
|
|
|
|
= typename enable_if<(__i < tuple_size<_Tuple>::value),
|
|
|
|
tuple_element<__i, _Tuple>>::type::type;
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps an argument to bind() into an actual argument to the bound
|
2015-12-15 15:17:27 +01:00
|
|
|
* function object [func.bind.bind]/10. Only the first parameter should
|
2009-11-30 10:34:04 +01:00
|
|
|
* be specified: the rest are used to determine among the various
|
|
|
|
* implementations. Note that, although this class is a function
|
|
|
|
* object, it isn't entirely normal because it takes only two
|
|
|
|
* parameters regardless of the number of parameters passed to the
|
|
|
|
* bind expression. The first parameter is the bound argument and
|
|
|
|
* the second parameter is a tuple containing references to the
|
|
|
|
* rest of the arguments.
|
|
|
|
*/
|
|
|
|
template<typename _Arg,
|
2011-03-15 01:24:08 +01:00
|
|
|
bool _IsBindExp = is_bind_expression<_Arg>::value,
|
|
|
|
bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)>
|
2009-11-30 10:34:04 +01:00
|
|
|
class _Mu;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If the argument is reference_wrapper<_Tp>, returns the
|
2015-12-15 15:17:27 +01:00
|
|
|
* underlying reference.
|
|
|
|
* C++11 [func.bind.bind] p10 bullet 1.
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Tp>
|
|
|
|
class _Mu<reference_wrapper<_Tp>, false, false>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/* Note: This won't actually work for const volatile
|
|
|
|
* reference_wrappers, because reference_wrapper::get() is const
|
|
|
|
* but not volatile-qualified. This might be a defect in the TR.
|
|
|
|
*/
|
|
|
|
template<typename _CVRef, typename _Tuple>
|
2015-12-15 15:17:27 +01:00
|
|
|
_Tp&
|
2011-03-15 01:24:08 +01:00
|
|
|
operator()(_CVRef& __arg, _Tuple&) const volatile
|
|
|
|
{ return __arg.get(); }
|
2009-11-30 10:34:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If the argument is a bind expression, we invoke the underlying
|
|
|
|
* function object with the same cv-qualifiers as we are given and
|
2015-12-15 15:17:27 +01:00
|
|
|
* pass along all of our arguments (unwrapped).
|
|
|
|
* C++11 [func.bind.bind] p10 bullet 2.
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Arg>
|
|
|
|
class _Mu<_Arg, true, false>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
template<typename _CVArg, typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
auto
|
|
|
|
operator()(_CVArg& __arg,
|
2010-10-08 02:44:12 +02:00
|
|
|
tuple<_Args...>& __tuple) const volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
-> decltype(__arg(declval<_Args>()...))
|
|
|
|
{
|
2009-11-30 10:34:04 +01:00
|
|
|
// Construct an index tuple and forward to __call
|
|
|
|
typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
|
|
|
|
_Indexes;
|
2010-10-08 02:44:12 +02:00
|
|
|
return this->__call(__arg, __tuple, _Indexes());
|
2009-11-30 10:34:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Invokes the underlying function object __arg by unpacking all
|
2011-03-15 01:24:08 +01:00
|
|
|
// of the arguments in the tuple.
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _CVArg, typename... _Args, std::size_t... _Indexes>
|
2011-03-15 01:24:08 +01:00
|
|
|
auto
|
|
|
|
__call(_CVArg& __arg, tuple<_Args...>& __tuple,
|
2009-11-30 10:34:04 +01:00
|
|
|
const _Index_tuple<_Indexes...>&) const volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
-> decltype(__arg(declval<_Args>()...))
|
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return __arg(std::get<_Indexes>(std::move(__tuple))...);
|
2009-11-30 10:34:04 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If the argument is a placeholder for the Nth argument, returns
|
|
|
|
* a reference to the Nth argument to the bind function object.
|
2015-12-15 15:17:27 +01:00
|
|
|
* C++11 [func.bind.bind] p10 bullet 3.
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Arg>
|
|
|
|
class _Mu<_Arg, false, true>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
template<typename _Tuple>
|
2015-12-15 15:17:27 +01:00
|
|
|
_Safe_tuple_element_t<(is_placeholder<_Arg>::value - 1), _Tuple>&&
|
2011-03-15 01:24:08 +01:00
|
|
|
operator()(const volatile _Arg&, _Tuple& __tuple) const volatile
|
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return
|
|
|
|
::std::get<(is_placeholder<_Arg>::value - 1)>(std::move(__tuple));
|
2009-11-30 10:34:04 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If the argument is just a value, returns a reference to that
|
2015-12-15 15:17:27 +01:00
|
|
|
* value. The cv-qualifiers on the reference are determined by the caller.
|
|
|
|
* C++11 [func.bind.bind] p10 bullet 4.
|
2009-11-30 10:34:04 +01:00
|
|
|
*/
|
|
|
|
template<typename _Arg>
|
|
|
|
class _Mu<_Arg, false, false>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
template<typename _CVArg, typename _Tuple>
|
2011-03-15 01:24:08 +01:00
|
|
|
_CVArg&&
|
2015-12-15 18:06:25 +01:00
|
|
|
operator()(_CVArg&& __arg, _Tuple&) const volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{ return std::forward<_CVArg>(__arg); }
|
2009-11-30 10:34:04 +01:00
|
|
|
};
|
|
|
|
|
2010-10-08 02:44:12 +02:00
|
|
|
// std::get<I> for volatile-qualified tuples
|
2011-09-10 02:47:02 +02:00
|
|
|
template<std::size_t _Ind, typename... _Tp>
|
2010-10-08 02:44:12 +02:00
|
|
|
inline auto
|
|
|
|
__volget(volatile tuple<_Tp...>& __tuple)
|
2014-05-15 00:16:35 +02:00
|
|
|
-> __tuple_element_t<_Ind, tuple<_Tp...>> volatile&
|
2010-10-08 02:44:12 +02:00
|
|
|
{ return std::get<_Ind>(const_cast<tuple<_Tp...>&>(__tuple)); }
|
|
|
|
|
|
|
|
// std::get<I> for const-volatile-qualified tuples
|
2011-09-10 02:47:02 +02:00
|
|
|
template<std::size_t _Ind, typename... _Tp>
|
2010-10-08 02:44:12 +02:00
|
|
|
inline auto
|
|
|
|
__volget(const volatile tuple<_Tp...>& __tuple)
|
2014-05-15 00:16:35 +02:00
|
|
|
-> __tuple_element_t<_Ind, tuple<_Tp...>> const volatile&
|
2010-10-08 02:44:12 +02:00
|
|
|
{ return std::get<_Ind>(const_cast<const tuple<_Tp...>&>(__tuple)); }
|
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
/// Type of the function object returned from bind().
|
|
|
|
template<typename _Signature>
|
|
|
|
struct _Bind;
|
|
|
|
|
|
|
|
template<typename _Functor, typename... _Bound_args>
|
|
|
|
class _Bind<_Functor(_Bound_args...)>
|
|
|
|
: public _Weak_result_type<_Functor>
|
|
|
|
{
|
2010-10-08 02:44:12 +02:00
|
|
|
typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
|
2011-03-15 01:24:08 +01:00
|
|
|
_Bound_indexes;
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
_Functor _M_f;
|
|
|
|
tuple<_Bound_args...> _M_bound_args;
|
|
|
|
|
|
|
|
// Call unqualified
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Result, typename... _Args, std::size_t... _Indexes>
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
|
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f,
|
|
|
|
_Mu<_Bound_args>()(std::get<_Indexes>(_M_bound_args), __args)...
|
|
|
|
);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as const
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Result, typename... _Args, std::size_t... _Indexes>
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
__call_c(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
|
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f,
|
|
|
|
_Mu<_Bound_args>()(std::get<_Indexes>(_M_bound_args), __args)...
|
|
|
|
);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as volatile
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Result, typename... _Args, std::size_t... _Indexes>
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
__call_v(tuple<_Args...>&& __args,
|
2010-01-17 14:29:41 +01:00
|
|
|
_Index_tuple<_Indexes...>) volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f,
|
|
|
|
_Mu<_Bound_args>()(__volget<_Indexes>(_M_bound_args), __args)...
|
|
|
|
);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as const volatile
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Result, typename... _Args, std::size_t... _Indexes>
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
__call_c_v(tuple<_Args...>&& __args,
|
2010-01-17 14:29:41 +01:00
|
|
|
_Index_tuple<_Indexes...>) const volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f,
|
|
|
|
_Mu<_Bound_args>()(__volget<_Indexes>(_M_bound_args), __args)...
|
|
|
|
);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
template<typename _BoundArg, typename _CallArgs>
|
|
|
|
using _Mu_type = decltype(
|
|
|
|
_Mu<typename remove_cv<_BoundArg>::type>()(
|
|
|
|
std::declval<_BoundArg&>(), std::declval<_CallArgs&>()) );
|
|
|
|
|
|
|
|
template<typename _Fn, typename _CallArgs, typename... _BArgs>
|
|
|
|
using _Res_type_impl
|
2017-03-02 04:43:36 +01:00
|
|
|
= typename result_of< _Fn&(_Mu_type<_BArgs, _CallArgs>&&...) >::type;
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
|
|
|
|
template<typename _CallArgs>
|
|
|
|
using _Res_type = _Res_type_impl<_Functor, _CallArgs, _Bound_args...>;
|
|
|
|
|
|
|
|
template<typename _CallArgs>
|
|
|
|
using __dependent = typename
|
|
|
|
enable_if<bool(tuple_size<_CallArgs>::value+1), _Functor>::type;
|
|
|
|
|
|
|
|
template<typename _CallArgs, template<class> class __cv_quals>
|
|
|
|
using _Res_type_cv = _Res_type_impl<
|
|
|
|
typename __cv_quals<__dependent<_CallArgs>>::type,
|
|
|
|
_CallArgs,
|
|
|
|
typename __cv_quals<_Bound_args>::type...>;
|
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
public:
|
2010-10-08 02:44:12 +02:00
|
|
|
template<typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
explicit _Bind(const _Functor& __f, _Args&&... __args)
|
|
|
|
: _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...)
|
|
|
|
{ }
|
2010-10-08 02:44:12 +02:00
|
|
|
|
|
|
|
template<typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
explicit _Bind(_Functor&& __f, _Args&&... __args)
|
|
|
|
: _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...)
|
|
|
|
{ }
|
2010-10-08 02:44:12 +02:00
|
|
|
|
|
|
|
_Bind(const _Bind&) = default;
|
|
|
|
|
|
|
|
_Bind(_Bind&& __b)
|
|
|
|
: _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args))
|
2010-01-12 01:53:30 +01:00
|
|
|
{ }
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call unqualified
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
template<typename... _Args,
|
|
|
|
typename _Result = _Res_type<tuple<_Args...>>>
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
operator()(_Args&&... __args)
|
|
|
|
{
|
|
|
|
return this->__call<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as const
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
template<typename... _Args,
|
|
|
|
typename _Result = _Res_type_cv<tuple<_Args...>, add_const>>
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
operator()(_Args&&... __args) const
|
|
|
|
{
|
|
|
|
return this->__call_c<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
#if __cplusplus > 201402L
|
|
|
|
# define _GLIBCXX_DEPR_BIND \
|
|
|
|
[[deprecated("std::bind does not support volatile in C++17")]]
|
|
|
|
#else
|
|
|
|
# define _GLIBCXX_DEPR_BIND
|
|
|
|
#endif
|
2009-11-30 10:34:04 +01:00
|
|
|
// Call as volatile
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
template<typename... _Args,
|
|
|
|
typename _Result = _Res_type_cv<tuple<_Args...>, add_volatile>>
|
|
|
|
_GLIBCXX_DEPR_BIND
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
operator()(_Args&&... __args) volatile
|
|
|
|
{
|
|
|
|
return this->__call_v<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as const volatile
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
template<typename... _Args,
|
|
|
|
typename _Result = _Res_type_cv<tuple<_Args...>, add_cv>>
|
|
|
|
_GLIBCXX_DEPR_BIND
|
2011-03-15 01:24:08 +01:00
|
|
|
_Result
|
|
|
|
operator()(_Args&&... __args) const volatile
|
|
|
|
{
|
|
|
|
return this->__call_c_v<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Type of the function object returned from bind<R>().
|
|
|
|
template<typename _Result, typename _Signature>
|
|
|
|
struct _Bind_result;
|
|
|
|
|
|
|
|
template<typename _Result, typename _Functor, typename... _Bound_args>
|
|
|
|
class _Bind_result<_Result, _Functor(_Bound_args...)>
|
|
|
|
{
|
2011-03-15 01:24:08 +01:00
|
|
|
typedef typename _Build_index_tuple<sizeof...(_Bound_args)>::__type
|
|
|
|
_Bound_indexes;
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
_Functor _M_f;
|
|
|
|
tuple<_Bound_args...> _M_bound_args;
|
|
|
|
|
2009-12-24 15:54:33 +01:00
|
|
|
// sfinae types
|
|
|
|
template<typename _Res>
|
2016-10-10 18:15:52 +02:00
|
|
|
using __enable_if_void
|
|
|
|
= typename enable_if<is_void<_Res>{}>::type;
|
|
|
|
|
2009-12-24 15:54:33 +01:00
|
|
|
template<typename _Res>
|
2016-10-10 18:15:52 +02:00
|
|
|
using __disable_if_void
|
|
|
|
= typename enable_if<!is_void<_Res>{}, _Result>::type;
|
2009-12-24 15:54:33 +01:00
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
// Call unqualified
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__disable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f, _Mu<_Bound_args>()
|
2014-05-13 19:22:08 +02:00
|
|
|
(std::get<_Indexes>(_M_bound_args), __args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2009-12-24 15:54:33 +01:00
|
|
|
// Call unqualified, return void
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__enable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
std::__invoke(_M_f, _Mu<_Bound_args>()
|
2014-05-13 19:22:08 +02:00
|
|
|
(std::get<_Indexes>(_M_bound_args), __args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-12-24 15:54:33 +01:00
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
// Call as const
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__disable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f, _Mu<_Bound_args>()
|
2014-05-13 19:22:08 +02:00
|
|
|
(std::get<_Indexes>(_M_bound_args), __args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2009-12-24 15:54:33 +01:00
|
|
|
// Call as const, return void
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__enable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) const
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
std::__invoke(_M_f, _Mu<_Bound_args>()
|
2014-05-13 19:22:08 +02:00
|
|
|
(std::get<_Indexes>(_M_bound_args), __args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-12-24 15:54:33 +01:00
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
// Call as volatile
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__disable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f, _Mu<_Bound_args>()
|
2011-03-15 01:24:08 +01:00
|
|
|
(__volget<_Indexes>(_M_bound_args), __args)...);
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2009-12-24 15:54:33 +01:00
|
|
|
// Call as volatile, return void
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__enable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>) volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
std::__invoke(_M_f, _Mu<_Bound_args>()
|
2010-10-08 02:44:12 +02:00
|
|
|
(__volget<_Indexes>(_M_bound_args), __args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-12-24 15:54:33 +01:00
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
// Call as const volatile
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__disable_if_void<_Res>
|
|
|
|
__call(tuple<_Args...>&& __args,
|
|
|
|
_Index_tuple<_Indexes...>) const volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return std::__invoke(_M_f, _Mu<_Bound_args>()
|
2011-03-15 01:24:08 +01:00
|
|
|
(__volget<_Indexes>(_M_bound_args), __args)...);
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2009-12-24 15:54:33 +01:00
|
|
|
// Call as const volatile, return void
|
2011-09-10 02:47:02 +02:00
|
|
|
template<typename _Res, typename... _Args, std::size_t... _Indexes>
|
2016-10-10 18:15:52 +02:00
|
|
|
__enable_if_void<_Res>
|
2011-03-15 01:24:08 +01:00
|
|
|
__call(tuple<_Args...>&& __args,
|
2016-10-10 18:15:52 +02:00
|
|
|
_Index_tuple<_Indexes...>) const volatile
|
2011-03-15 01:24:08 +01:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
std::__invoke(_M_f, _Mu<_Bound_args>()
|
2010-10-08 02:44:12 +02:00
|
|
|
(__volget<_Indexes>(_M_bound_args), __args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-12-24 15:54:33 +01:00
|
|
|
|
2009-11-30 10:34:04 +01:00
|
|
|
public:
|
|
|
|
typedef _Result result_type;
|
|
|
|
|
2010-10-08 02:44:12 +02:00
|
|
|
template<typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
explicit _Bind_result(const _Functor& __f, _Args&&... __args)
|
|
|
|
: _M_f(__f), _M_bound_args(std::forward<_Args>(__args)...)
|
|
|
|
{ }
|
2010-10-08 02:44:12 +02:00
|
|
|
|
|
|
|
template<typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
explicit _Bind_result(_Functor&& __f, _Args&&... __args)
|
|
|
|
: _M_f(std::move(__f)), _M_bound_args(std::forward<_Args>(__args)...)
|
|
|
|
{ }
|
2010-10-08 02:44:12 +02:00
|
|
|
|
|
|
|
_Bind_result(const _Bind_result&) = default;
|
|
|
|
|
|
|
|
_Bind_result(_Bind_result&& __b)
|
|
|
|
: _M_f(std::move(__b._M_f)), _M_bound_args(std::move(__b._M_bound_args))
|
2010-01-12 01:53:30 +01:00
|
|
|
{ }
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call unqualified
|
|
|
|
template<typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
result_type
|
|
|
|
operator()(_Args&&... __args)
|
|
|
|
{
|
|
|
|
return this->__call<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as const
|
|
|
|
template<typename... _Args>
|
2011-03-15 01:24:08 +01:00
|
|
|
result_type
|
|
|
|
operator()(_Args&&... __args) const
|
|
|
|
{
|
|
|
|
return this->__call<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as volatile
|
|
|
|
template<typename... _Args>
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
_GLIBCXX_DEPR_BIND
|
2011-03-15 01:24:08 +01:00
|
|
|
result_type
|
|
|
|
operator()(_Args&&... __args) volatile
|
|
|
|
{
|
|
|
|
return this->__call<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
|
|
|
// Call as const volatile
|
|
|
|
template<typename... _Args>
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
_GLIBCXX_DEPR_BIND
|
2011-03-15 01:24:08 +01:00
|
|
|
result_type
|
|
|
|
operator()(_Args&&... __args) const volatile
|
|
|
|
{
|
|
|
|
return this->__call<_Result>(
|
|
|
|
std::forward_as_tuple(std::forward<_Args>(__args)...),
|
|
|
|
_Bound_indexes());
|
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
};
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
#undef _GLIBCXX_DEPR_BIND
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2010-02-10 06:45:24 +01:00
|
|
|
/**
|
|
|
|
* @brief Class template _Bind is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
2009-11-30 10:34:04 +01:00
|
|
|
template<typename _Signature>
|
|
|
|
struct is_bind_expression<_Bind<_Signature> >
|
2010-01-26 14:33:06 +01:00
|
|
|
: public true_type { };
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2010-02-10 06:45:24 +01:00
|
|
|
/**
|
|
|
|
* @brief Class template _Bind is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
2011-11-22 01:40:47 +01:00
|
|
|
template<typename _Signature>
|
|
|
|
struct is_bind_expression<const _Bind<_Signature> >
|
|
|
|
: public true_type { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Class template _Bind is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
|
|
|
template<typename _Signature>
|
|
|
|
struct is_bind_expression<volatile _Bind<_Signature> >
|
|
|
|
: public true_type { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Class template _Bind is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
|
|
|
template<typename _Signature>
|
|
|
|
struct is_bind_expression<const volatile _Bind<_Signature>>
|
|
|
|
: public true_type { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Class template _Bind_result is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
|
|
|
template<typename _Result, typename _Signature>
|
|
|
|
struct is_bind_expression<_Bind_result<_Result, _Signature>>
|
|
|
|
: public true_type { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Class template _Bind_result is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
|
|
|
template<typename _Result, typename _Signature>
|
|
|
|
struct is_bind_expression<const _Bind_result<_Result, _Signature>>
|
|
|
|
: public true_type { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Class template _Bind_result is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
|
|
|
template<typename _Result, typename _Signature>
|
|
|
|
struct is_bind_expression<volatile _Bind_result<_Result, _Signature>>
|
|
|
|
: public true_type { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Class template _Bind_result is always a bind expression.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
2009-11-30 10:34:04 +01:00
|
|
|
template<typename _Result, typename _Signature>
|
2011-11-22 01:40:47 +01:00
|
|
|
struct is_bind_expression<const volatile _Bind_result<_Result, _Signature>>
|
2010-01-26 14:33:06 +01:00
|
|
|
: public true_type { };
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2014-11-03 03:55:36 +01:00
|
|
|
template<typename _Func, typename... _BoundArgs>
|
|
|
|
struct _Bind_check_arity { };
|
|
|
|
|
|
|
|
template<typename _Ret, typename... _Args, typename... _BoundArgs>
|
|
|
|
struct _Bind_check_arity<_Ret (*)(_Args...), _BoundArgs...>
|
|
|
|
{
|
|
|
|
static_assert(sizeof...(_BoundArgs) == sizeof...(_Args),
|
|
|
|
"Wrong number of arguments for function");
|
|
|
|
};
|
|
|
|
|
2014-11-12 00:38:34 +01:00
|
|
|
template<typename _Ret, typename... _Args, typename... _BoundArgs>
|
|
|
|
struct _Bind_check_arity<_Ret (*)(_Args......), _BoundArgs...>
|
|
|
|
{
|
|
|
|
static_assert(sizeof...(_BoundArgs) >= sizeof...(_Args),
|
|
|
|
"Wrong number of arguments for function");
|
|
|
|
};
|
|
|
|
|
2014-11-03 03:55:36 +01:00
|
|
|
template<typename _Tp, typename _Class, typename... _BoundArgs>
|
|
|
|
struct _Bind_check_arity<_Tp _Class::*, _BoundArgs...>
|
|
|
|
{
|
|
|
|
using _Arity = typename _Mem_fn<_Tp _Class::*>::_Arity;
|
2014-11-12 00:38:34 +01:00
|
|
|
using _Varargs = typename _Mem_fn<_Tp _Class::*>::_Varargs;
|
|
|
|
static_assert(_Varargs::value
|
|
|
|
? sizeof...(_BoundArgs) >= _Arity::value + 1
|
|
|
|
: sizeof...(_BoundArgs) == _Arity::value + 1,
|
|
|
|
"Wrong number of arguments for pointer-to-member");
|
2014-11-03 03:55:36 +01:00
|
|
|
};
|
|
|
|
|
2011-05-03 02:03:38 +02:00
|
|
|
// Trait type used to remove std::bind() from overload set via SFINAE
|
|
|
|
// when first argument has integer type, so that std::bind() will
|
|
|
|
// not be a better match than ::bind() from the BSD Sockets API.
|
2012-11-27 00:53:36 +01:00
|
|
|
template<typename _Tp, typename _Tp2 = typename decay<_Tp>::type>
|
|
|
|
using __is_socketlike = __or_<is_integral<_Tp2>, is_enum<_Tp2>>;
|
2011-05-03 02:03:38 +02:00
|
|
|
|
|
|
|
template<bool _SocketLike, typename _Func, typename... _BoundArgs>
|
2010-10-08 02:44:12 +02:00
|
|
|
struct _Bind_helper
|
2014-11-03 03:55:36 +01:00
|
|
|
: _Bind_check_arity<typename decay<_Func>::type, _BoundArgs...>
|
2010-10-08 02:44:12 +02:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
typedef typename decay<_Func>::type __func_type;
|
2011-05-03 02:03:38 +02:00
|
|
|
typedef _Bind<__func_type(typename decay<_BoundArgs>::type...)> type;
|
2010-10-08 02:44:12 +02:00
|
|
|
};
|
|
|
|
|
2011-05-03 02:03:38 +02:00
|
|
|
// Partial specialization for is_socketlike == true, does not define
|
|
|
|
// nested type so std::bind() will not participate in overload resolution
|
|
|
|
// when the first argument might be a socket file descriptor.
|
|
|
|
template<typename _Func, typename... _BoundArgs>
|
|
|
|
struct _Bind_helper<true, _Func, _BoundArgs...>
|
|
|
|
{ };
|
|
|
|
|
2010-02-10 06:45:24 +01:00
|
|
|
/**
|
|
|
|
* @brief Function template for std::bind.
|
|
|
|
* @ingroup binders
|
|
|
|
*/
|
2011-05-03 02:03:38 +02:00
|
|
|
template<typename _Func, typename... _BoundArgs>
|
|
|
|
inline typename
|
|
|
|
_Bind_helper<__is_socketlike<_Func>::value, _Func, _BoundArgs...>::type
|
|
|
|
bind(_Func&& __f, _BoundArgs&&... __args)
|
2009-11-30 10:34:04 +01:00
|
|
|
{
|
2011-05-03 02:03:38 +02:00
|
|
|
typedef _Bind_helper<false, _Func, _BoundArgs...> __helper_type;
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return typename __helper_type::type(std::forward<_Func>(__f),
|
|
|
|
std::forward<_BoundArgs>(__args)...);
|
2011-03-15 01:24:08 +01:00
|
|
|
}
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2011-05-03 02:03:38 +02:00
|
|
|
template<typename _Result, typename _Func, typename... _BoundArgs>
|
2010-10-08 02:44:12 +02:00
|
|
|
struct _Bindres_helper
|
2014-11-03 03:55:36 +01:00
|
|
|
: _Bind_check_arity<typename decay<_Func>::type, _BoundArgs...>
|
2010-10-08 02:44:12 +02:00
|
|
|
{
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
typedef typename decay<_Func>::type __functor_type;
|
2010-10-08 02:44:12 +02:00
|
|
|
typedef _Bind_result<_Result,
|
2011-05-03 02:03:38 +02:00
|
|
|
__functor_type(typename decay<_BoundArgs>::type...)>
|
2011-03-15 01:24:08 +01:00
|
|
|
type;
|
2010-10-08 02:44:12 +02:00
|
|
|
};
|
|
|
|
|
2010-02-10 06:45:24 +01:00
|
|
|
/**
|
2010-10-08 02:44:12 +02:00
|
|
|
* @brief Function template for std::bind<R>.
|
2010-02-10 06:45:24 +01:00
|
|
|
* @ingroup binders
|
|
|
|
*/
|
2011-05-03 02:03:38 +02:00
|
|
|
template<typename _Result, typename _Func, typename... _BoundArgs>
|
2009-11-30 10:34:04 +01:00
|
|
|
inline
|
2011-05-03 02:03:38 +02:00
|
|
|
typename _Bindres_helper<_Result, _Func, _BoundArgs...>::type
|
|
|
|
bind(_Func&& __f, _BoundArgs&&... __args)
|
2009-11-30 10:34:04 +01:00
|
|
|
{
|
2011-05-03 02:03:38 +02:00
|
|
|
typedef _Bindres_helper<_Result, _Func, _BoundArgs...> __helper_type;
|
Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
Simplify forwarding from tuple of references.
(_Maybe_wrap_member_pointer): Remove.
(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
Use std::__invoke.
(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
return type deduction.
(_Bind::operator(), _Bind::operator() const): Use new helpers.
(_Bind::operator() volatile, _Bind::operator() const volatile):
Likewise. Add deprecated attribute for C++17 mode.
(_Bind_result::__call): Use std::__invoke.
(_Bind_result::operator() volatile)
(_Bind_result::operator() const volatile): Add deprecated attribute.
(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
(bind, bind<R>): Don't use __maybe_type.
* src/c++11/compatibility-thread-c++0x.cc
(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
in C++17 mode.
* testsuite/20_util/bind/cv_quals.cc: Likewise.
* testsuite/20_util/bind/cv_quals_2.cc: Likewise.
From-SVN: r241178
2016-10-14 21:04:56 +02:00
|
|
|
return typename __helper_type::type(std::forward<_Func>(__f),
|
|
|
|
std::forward<_BoundArgs>(__args)...);
|
2009-11-30 10:34:04 +01:00
|
|
|
}
|
|
|
|
|
2016-10-05 14:01:36 +02:00
|
|
|
#if __cplusplus >= 201402L
|
|
|
|
/// Generalized negator.
|
2016-08-19 17:42:34 +02:00
|
|
|
template<typename _Fn>
|
|
|
|
class _Not_fn
|
|
|
|
{
|
2016-10-13 12:19:24 +02:00
|
|
|
template<typename _Fn2, typename... _Args>
|
P0604R0 add invoke_result, is_invocable etc. for C++17
* include/bits/invoke.h (__invoke): Use __invoke_result instead of
result_of, and __is_nothrow_invocable instead of
__is_nothrow_callable.
* include/bits/shared_ptr_base.h (__shared_ptr): Use __is_invocable
instead of __is_callable.
* include/std/functional (invoke): use invoke_result_t instead of
result_of_t and is_nothrow_invocable instead of is_nothrow_callable.
(_Not_fn): Use __invoke_result instead of result_of.
* include/std/type_traits (__result_of_memobj, __result_of_memfun):
Remove partial specializations for reference_wrapper types.
(__result_of_impl): Use __inv_unwrap to strip reference_wrapper.
(__invoke_result): Define replacement for result_of and then use it to
define result_of.
(__is_callable_impl, __is_callable, __is_nothrow_callable): Replace
with __is_invocable_impl, __is_invocable, and __is_nothrow_invocable
respectively.
(invoke_result, invoke_result_t): Define for C++17.
(is_callable, is_nothrow_callable): Replace with is_invocable,
is_invocable_r, is_nothrow_invocable, and is_nothrow_invocable_r.
(is_callable_v, is_nothrow_callable_v): Replace with is_invocable_v,
is_invocable_r_v, is_nothrow_invocable_v, and is_nothrow_invocable_r_v.
* include/std/variant (hash<variant<T...>>): Use is_nothrow_invocable_v
instead of is_nothrow_callable_v.
* testsuite/20_util/function_objects/invoke/59768.cc: Remove unused
main function.
* testsuite/20_util/function_objects/not_fn/1.cc: Use is_invocable
instead of is_callable.
* testsuite/20_util/is_callable/*: Rename directory and adjust tests
to use new traits.
* testsuite/20_util/is_notjrow_callable/*: Likewise.
* testsuite/20_util/optional/hash.cc: Use is_invocable_v instead of
is_callable.
* testsuite/20_util/variant/hash.cc: Likewise.
From-SVN: r246036
2017-03-10 16:29:38 +01:00
|
|
|
using __inv_res_t = typename __invoke_result<_Fn2, _Args...>::type;
|
2017-03-09 21:36:42 +01:00
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
static decltype(!std::declval<_Tp>())
|
|
|
|
_S_not() noexcept(noexcept(!std::declval<_Tp>()));
|
2016-10-13 12:19:24 +02:00
|
|
|
|
2016-08-19 17:42:34 +02:00
|
|
|
public:
|
|
|
|
template<typename _Fn2>
|
2016-10-05 14:01:36 +02:00
|
|
|
_Not_fn(_Fn2&& __fn, int)
|
2016-08-19 17:42:34 +02:00
|
|
|
: _M_fn(std::forward<_Fn2>(__fn)) { }
|
|
|
|
|
|
|
|
_Not_fn(const _Not_fn& __fn) = default;
|
|
|
|
_Not_fn(_Not_fn&& __fn) = default;
|
|
|
|
~_Not_fn() = default;
|
|
|
|
|
2017-03-09 21:36:42 +01:00
|
|
|
// Macro to define operator() with given cv-qualifiers ref-qualifiers,
|
|
|
|
// forwarding _M_fn and the function arguments with the same qualifiers,
|
|
|
|
// and deducing the return type and exception-specification.
|
|
|
|
#define _GLIBCXX_NOT_FN_CALL_OP( _QUALS ) \
|
|
|
|
template<typename... _Args> \
|
|
|
|
decltype(_S_not<__inv_res_t<_Fn _QUALS, _Args...>>()) \
|
|
|
|
operator()(_Args&&... __args) _QUALS \
|
|
|
|
noexcept(noexcept(_S_not<__inv_res_t<_Fn _QUALS, _Args...>>())) \
|
|
|
|
{ \
|
|
|
|
return !std::__invoke(std::forward< _Fn _QUALS >(_M_fn), \
|
|
|
|
std::forward<_Args>(__args)...); \
|
2016-08-19 17:42:34 +02:00
|
|
|
}
|
2017-03-09 21:36:42 +01:00
|
|
|
_GLIBCXX_NOT_FN_CALL_OP( & )
|
|
|
|
_GLIBCXX_NOT_FN_CALL_OP( const & )
|
|
|
|
_GLIBCXX_NOT_FN_CALL_OP( && )
|
|
|
|
_GLIBCXX_NOT_FN_CALL_OP( const && )
|
|
|
|
#undef _GLIBCXX_NOT_FN_CALL
|
2016-08-19 17:42:34 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
_Fn _M_fn;
|
|
|
|
};
|
2016-10-05 14:01:36 +02:00
|
|
|
|
2018-01-04 11:21:29 +01:00
|
|
|
template<typename _Tp, typename _Pred>
|
|
|
|
struct __is_byte_like : false_type { };
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
struct __is_byte_like<_Tp, equal_to<_Tp>>
|
|
|
|
: __bool_constant<sizeof(_Tp) == 1 && is_integral<_Tp>::value> { };
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
struct __is_byte_like<_Tp, equal_to<void>>
|
|
|
|
: __bool_constant<sizeof(_Tp) == 1 && is_integral<_Tp>::value> { };
|
|
|
|
|
|
|
|
#if __cplusplus >= 201703L
|
|
|
|
// Declare std::byte (full definition is in <cstddef>).
|
|
|
|
enum class byte : unsigned char;
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __is_byte_like<byte, equal_to<byte>>
|
|
|
|
: true_type { };
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct __is_byte_like<byte, equal_to<void>>
|
|
|
|
: true_type { };
|
|
|
|
|
2016-10-05 14:01:36 +02:00
|
|
|
#define __cpp_lib_not_fn 201603
|
2016-08-19 17:42:34 +02:00
|
|
|
/// [func.not_fn] Function template not_fn
|
|
|
|
template<typename _Fn>
|
|
|
|
inline auto
|
|
|
|
not_fn(_Fn&& __fn)
|
|
|
|
noexcept(std::is_nothrow_constructible<std::decay_t<_Fn>, _Fn&&>::value)
|
|
|
|
{
|
2016-10-05 14:01:36 +02:00
|
|
|
return _Not_fn<std::decay_t<_Fn>>{std::forward<_Fn>(__fn), 0};
|
2016-08-19 17:42:34 +02:00
|
|
|
}
|
|
|
|
|
2016-09-12 17:48:07 +02:00
|
|
|
// Searchers
|
2016-09-27 17:39:51 +02:00
|
|
|
#define __cpp_lib_boyer_moore_searcher 201603
|
2016-09-12 17:48:07 +02:00
|
|
|
|
|
|
|
template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
|
|
|
|
class default_searcher
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
default_searcher(_ForwardIterator1 __pat_first,
|
|
|
|
_ForwardIterator1 __pat_last,
|
|
|
|
_BinaryPredicate __pred = _BinaryPredicate())
|
|
|
|
: _M_m(__pat_first, __pat_last, std::move(__pred))
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename _ForwardIterator2>
|
2016-09-12 17:48:32 +02:00
|
|
|
pair<_ForwardIterator2, _ForwardIterator2>
|
2016-09-12 17:48:07 +02:00
|
|
|
operator()(_ForwardIterator2 __first, _ForwardIterator2 __last) const
|
|
|
|
{
|
2016-09-12 17:48:32 +02:00
|
|
|
_ForwardIterator2 __first_ret =
|
2017-04-18 13:08:00 +02:00
|
|
|
std::search(__first, __last, std::get<0>(_M_m), std::get<1>(_M_m),
|
2016-09-12 17:48:32 +02:00
|
|
|
std::get<2>(_M_m));
|
2017-04-18 13:08:00 +02:00
|
|
|
auto __ret = std::make_pair(__first_ret, __first_ret);
|
|
|
|
if (__ret.first != __last)
|
|
|
|
std::advance(__ret.second, std::distance(std::get<0>(_M_m),
|
|
|
|
std::get<1>(_M_m)));
|
|
|
|
return __ret;
|
2016-09-12 17:48:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2017-04-18 13:08:00 +02:00
|
|
|
tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m;
|
2016-09-12 17:48:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
|
|
|
|
struct __boyer_moore_map_base
|
|
|
|
{
|
|
|
|
template<typename _RAIter>
|
|
|
|
__boyer_moore_map_base(_RAIter __pat, size_t __patlen,
|
|
|
|
_Hash&& __hf, _Pred&& __pred)
|
|
|
|
: _M_bad_char{ __patlen, std::move(__hf), std::move(__pred) }
|
|
|
|
{
|
|
|
|
if (__patlen > 0)
|
|
|
|
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
|
|
|
|
_M_bad_char[__pat[__i]] = __patlen - 1 - __i;
|
|
|
|
}
|
|
|
|
|
|
|
|
using __diff_type = _Tp;
|
|
|
|
|
|
|
|
__diff_type
|
|
|
|
_M_lookup(_Key __key, __diff_type __not_found) const
|
|
|
|
{
|
|
|
|
auto __iter = _M_bad_char.find(__key);
|
|
|
|
if (__iter == _M_bad_char.end())
|
|
|
|
return __not_found;
|
|
|
|
return __iter->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
_Pred
|
|
|
|
_M_pred() const { return _M_bad_char.key_eq(); }
|
|
|
|
|
2016-10-13 17:50:35 +02:00
|
|
|
_GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred> _M_bad_char;
|
2016-09-12 17:48:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _Tp, size_t _Len, typename _Pred>
|
|
|
|
struct __boyer_moore_array_base
|
|
|
|
{
|
|
|
|
template<typename _RAIter, typename _Unused>
|
|
|
|
__boyer_moore_array_base(_RAIter __pat, size_t __patlen,
|
|
|
|
_Unused&&, _Pred&& __pred)
|
2016-10-13 17:50:35 +02:00
|
|
|
: _M_bad_char{ _GLIBCXX_STD_C::array<_Tp, _Len>{}, std::move(__pred) }
|
2016-09-12 17:48:07 +02:00
|
|
|
{
|
|
|
|
std::get<0>(_M_bad_char).fill(__patlen);
|
|
|
|
if (__patlen > 0)
|
|
|
|
for (__diff_type __i = 0; __i < __patlen - 1; ++__i)
|
|
|
|
{
|
|
|
|
auto __ch = __pat[__i];
|
2017-04-18 13:08:00 +02:00
|
|
|
using _UCh = make_unsigned_t<decltype(__ch)>;
|
2016-09-12 17:48:07 +02:00
|
|
|
auto __uch = static_cast<_UCh>(__ch);
|
|
|
|
std::get<0>(_M_bad_char)[__uch] = __patlen - 1 - __i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
using __diff_type = _Tp;
|
|
|
|
|
|
|
|
template<typename _Key>
|
|
|
|
__diff_type
|
|
|
|
_M_lookup(_Key __key, __diff_type __not_found) const
|
|
|
|
{
|
2017-04-18 13:08:00 +02:00
|
|
|
auto __ukey = static_cast<make_unsigned_t<_Key>>(__key);
|
2016-09-12 17:48:07 +02:00
|
|
|
if (__ukey >= _Len)
|
|
|
|
return __not_found;
|
|
|
|
return std::get<0>(_M_bad_char)[__ukey];
|
|
|
|
}
|
|
|
|
|
|
|
|
const _Pred&
|
|
|
|
_M_pred() const { return std::get<1>(_M_bad_char); }
|
|
|
|
|
2017-04-18 13:08:00 +02:00
|
|
|
tuple<_GLIBCXX_STD_C::array<_Tp, _Len>, _Pred> _M_bad_char;
|
2016-09-12 17:48:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Use __boyer_moore_array_base when pattern consists of narrow characters
|
2018-01-04 11:21:29 +01:00
|
|
|
// (or std::byte) and uses std::equal_to as the predicate.
|
2016-09-12 17:48:07 +02:00
|
|
|
template<typename _RAIter, typename _Hash, typename _Pred,
|
|
|
|
typename _Val = typename iterator_traits<_RAIter>::value_type,
|
|
|
|
typename _Diff = typename iterator_traits<_RAIter>::difference_type>
|
|
|
|
using __boyer_moore_base_t
|
2018-01-04 11:21:29 +01:00
|
|
|
= conditional_t<__is_byte_like<_Val, _Pred>::value,
|
2017-04-18 13:08:00 +02:00
|
|
|
__boyer_moore_array_base<_Diff, 256, _Pred>,
|
|
|
|
__boyer_moore_map_base<_Val, _Diff, _Hash, _Pred>>;
|
2016-09-12 17:48:07 +02:00
|
|
|
|
|
|
|
template<typename _RAIter, typename _Hash
|
2017-04-18 13:08:00 +02:00
|
|
|
= hash<typename iterator_traits<_RAIter>::value_type>,
|
|
|
|
typename _BinaryPredicate = equal_to<>>
|
2016-09-12 17:48:07 +02:00
|
|
|
class boyer_moore_searcher
|
|
|
|
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
|
|
|
|
{
|
|
|
|
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
|
|
|
|
using typename _Base::__diff_type;
|
|
|
|
|
|
|
|
public:
|
|
|
|
boyer_moore_searcher(_RAIter __pat_first, _RAIter __pat_last,
|
|
|
|
_Hash __hf = _Hash(),
|
|
|
|
_BinaryPredicate __pred = _BinaryPredicate());
|
|
|
|
|
|
|
|
template<typename _RandomAccessIterator2>
|
2016-09-12 17:48:32 +02:00
|
|
|
pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
2016-09-12 17:48:07 +02:00
|
|
|
operator()(_RandomAccessIterator2 __first,
|
|
|
|
_RandomAccessIterator2 __last) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool
|
|
|
|
_M_is_prefix(_RAIter __word, __diff_type __len,
|
|
|
|
__diff_type __pos)
|
|
|
|
{
|
|
|
|
const auto& __pred = this->_M_pred();
|
|
|
|
__diff_type __suffixlen = __len - __pos;
|
|
|
|
for (__diff_type __i = 0; __i < __suffixlen; ++__i)
|
|
|
|
if (!__pred(__word[__i], __word[__pos + __i]))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
__diff_type
|
|
|
|
_M_suffix_length(_RAIter __word, __diff_type __len,
|
|
|
|
__diff_type __pos)
|
|
|
|
{
|
|
|
|
const auto& __pred = this->_M_pred();
|
|
|
|
__diff_type __i = 0;
|
|
|
|
while (__pred(__word[__pos - __i], __word[__len - 1 - __i])
|
|
|
|
&& __i < __pos)
|
|
|
|
{
|
|
|
|
++__i;
|
|
|
|
}
|
|
|
|
return __i;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Tp>
|
|
|
|
__diff_type
|
|
|
|
_M_bad_char_shift(_Tp __c) const
|
|
|
|
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
|
|
|
|
|
|
|
|
_RAIter _M_pat;
|
|
|
|
_RAIter _M_pat_end;
|
2016-10-13 17:50:35 +02:00
|
|
|
_GLIBCXX_STD_C::vector<__diff_type> _M_good_suffix;
|
2016-09-12 17:48:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _RAIter, typename _Hash
|
2017-04-18 13:08:00 +02:00
|
|
|
= hash<typename iterator_traits<_RAIter>::value_type>,
|
|
|
|
typename _BinaryPredicate = equal_to<>>
|
2016-09-12 17:48:07 +02:00
|
|
|
class boyer_moore_horspool_searcher
|
|
|
|
: __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>
|
|
|
|
{
|
|
|
|
using _Base = __boyer_moore_base_t<_RAIter, _Hash, _BinaryPredicate>;
|
|
|
|
using typename _Base::__diff_type;
|
|
|
|
|
|
|
|
public:
|
|
|
|
boyer_moore_horspool_searcher(_RAIter __pat,
|
|
|
|
_RAIter __pat_end,
|
|
|
|
_Hash __hf = _Hash(),
|
|
|
|
_BinaryPredicate __pred
|
|
|
|
= _BinaryPredicate())
|
|
|
|
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
|
|
|
|
_M_pat(__pat), _M_pat_end(__pat_end)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
template<typename _RandomAccessIterator2>
|
2016-09-12 17:48:32 +02:00
|
|
|
pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
2016-09-12 17:48:07 +02:00
|
|
|
operator()(_RandomAccessIterator2 __first,
|
|
|
|
_RandomAccessIterator2 __last) const
|
|
|
|
{
|
|
|
|
const auto& __pred = this->_M_pred();
|
|
|
|
auto __patlen = _M_pat_end - _M_pat;
|
|
|
|
if (__patlen == 0)
|
2016-09-12 17:48:32 +02:00
|
|
|
return std::make_pair(__first, __first);
|
2016-09-12 17:48:07 +02:00
|
|
|
auto __len = __last - __first;
|
|
|
|
while (__len >= __patlen)
|
|
|
|
{
|
|
|
|
for (auto __scan = __patlen - 1;
|
|
|
|
__pred(__first[__scan], _M_pat[__scan]); --__scan)
|
|
|
|
if (__scan == 0)
|
2017-04-18 13:08:00 +02:00
|
|
|
return std::make_pair(__first, __first + __patlen);
|
2016-09-12 17:48:07 +02:00
|
|
|
auto __shift = _M_bad_char_shift(__first[__patlen - 1]);
|
|
|
|
__len -= __shift;
|
|
|
|
__first += __shift;
|
|
|
|
}
|
2016-09-12 17:48:32 +02:00
|
|
|
return std::make_pair(__last, __last);
|
2016-09-12 17:48:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
template<typename _Tp>
|
|
|
|
__diff_type
|
|
|
|
_M_bad_char_shift(_Tp __c) const
|
|
|
|
{ return this->_M_lookup(__c, _M_pat_end - _M_pat); }
|
|
|
|
|
|
|
|
_RAIter _M_pat;
|
|
|
|
_RAIter _M_pat_end;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
|
|
|
|
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
|
|
|
|
boyer_moore_searcher(_RAIter __pat, _RAIter __pat_end,
|
|
|
|
_Hash __hf, _BinaryPredicate __pred)
|
|
|
|
: _Base(__pat, __pat_end - __pat, std::move(__hf), std::move(__pred)),
|
|
|
|
_M_pat(__pat), _M_pat_end(__pat_end), _M_good_suffix(__pat_end - __pat)
|
|
|
|
{
|
|
|
|
auto __patlen = __pat_end - __pat;
|
|
|
|
if (__patlen == 0)
|
|
|
|
return;
|
|
|
|
__diff_type __last_prefix = __patlen - 1;
|
|
|
|
for (__diff_type __p = __patlen - 1; __p >= 0; --__p)
|
|
|
|
{
|
|
|
|
if (_M_is_prefix(__pat, __patlen, __p + 1))
|
|
|
|
__last_prefix = __p + 1;
|
|
|
|
_M_good_suffix[__p] = __last_prefix + (__patlen - 1 - __p);
|
|
|
|
}
|
|
|
|
for (__diff_type __p = 0; __p < __patlen - 1; ++__p)
|
|
|
|
{
|
|
|
|
auto __slen = _M_suffix_length(__pat, __patlen, __p);
|
|
|
|
auto __pos = __patlen - 1 - __slen;
|
|
|
|
if (!__pred(__pat[__p - __slen], __pat[__pos]))
|
|
|
|
_M_good_suffix[__pos] = __patlen - 1 - __p + __slen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _RAIter, typename _Hash, typename _BinaryPredicate>
|
|
|
|
template<typename _RandomAccessIterator2>
|
2016-09-12 17:48:32 +02:00
|
|
|
pair<_RandomAccessIterator2, _RandomAccessIterator2>
|
2016-09-12 17:48:07 +02:00
|
|
|
boyer_moore_searcher<_RAIter, _Hash, _BinaryPredicate>::
|
|
|
|
operator()(_RandomAccessIterator2 __first,
|
|
|
|
_RandomAccessIterator2 __last) const
|
|
|
|
{
|
|
|
|
auto __patlen = _M_pat_end - _M_pat;
|
|
|
|
if (__patlen == 0)
|
2016-09-12 17:48:32 +02:00
|
|
|
return std::make_pair(__first, __first);
|
2016-09-12 17:48:07 +02:00
|
|
|
const auto& __pred = this->_M_pred();
|
|
|
|
__diff_type __i = __patlen - 1;
|
|
|
|
auto __stringlen = __last - __first;
|
|
|
|
while (__i < __stringlen)
|
|
|
|
{
|
|
|
|
__diff_type __j = __patlen - 1;
|
|
|
|
while (__j >= 0 && __pred(__first[__i], _M_pat[__j]))
|
|
|
|
{
|
|
|
|
--__i;
|
|
|
|
--__j;
|
|
|
|
}
|
|
|
|
if (__j < 0)
|
2017-04-18 13:08:00 +02:00
|
|
|
{
|
|
|
|
const auto __match = __first + __i + 1;
|
|
|
|
return std::make_pair(__match, __match + __patlen);
|
|
|
|
}
|
2016-09-12 17:48:07 +02:00
|
|
|
__i += std::max(_M_bad_char_shift(__first[__i]),
|
|
|
|
_M_good_suffix[__j]);
|
|
|
|
}
|
2016-09-12 17:48:32 +02:00
|
|
|
return std::make_pair(__last, __last);
|
2016-09-12 17:48:07 +02:00
|
|
|
}
|
|
|
|
|
2016-10-05 14:01:36 +02:00
|
|
|
#endif // C++17
|
Split <functional> into smaller pieces
* include/Makefile.am: Add <bits/refwrap.h> and <bits/std_function.h>.
Order alphabetically.
* include/Makefile.in: Regenerate.
* include/bits/refwrap.h: New header.
(_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
(_Reference_wrapper_base_impl, _Reference_wrapper_base)
(reference_wrapper, ref, cref): Move here from <functional>.
* include/bits/shared_ptr_base.h: Include <bits/refwrap.h> and
<bits/stl_function.h> instead of <functional>.
* include/bits/std_function.h: New header.
(_Maybe_unary_or_binary_function, bad_function_call)
(__is_location_invariant, _Nocopy_types, _Any_data)
(_Simple_type_wrapper, _Function_base, _Function_handler, function):
Move here from <functional>.
* include/bits/unique_ptr.h: Include <bits/stl_function.h>.
* include/std/functional: Include new headers and move components to
them.
* include/std/future: Include <bits/std_function.h> instead of
<functional>.
* include/std/mutex: Likewise.
* include/std/regex: Likewise.
* src/c++11/compatibility-thread-c++0x.cc: Include <functional>.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
lines.
* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
* testsuite/30_threads/packaged_task/49668.cc: Include <functional>.
From-SVN: r241410
2016-10-21 17:32:25 +02:00
|
|
|
#endif // C++14
|
2016-08-19 17:42:34 +02:00
|
|
|
|
PR libstdc++/36104 part four
2011-01-30 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/36104 part four
* include/bits/c++config (_GLIBCXX_STD): Remove.
(_GLIBCXX_STD_D, _GLIBCXX_PR): Now _GLIBCXX_STD_C.
(_GLIBCXX_P): Now _GLIBCXX_STD_A.
(_GLIBCXX_NAMESPACE_DEBUG, _GLIBCXX_NAMESPACE_PARALLEL,
_GLIBCXX_NAMESPACE_PROFILE, _GLIBCXX_NAMESPACE_VERSION): Remove.
(_GLIBCXX_INLINE_DEBUG, _GLIBCXX_INLINE_PARALLEL,
_GLIBCXX_INLINE_PROFILE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE(X)): Remove.
(_GLIBCXX_END_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)): Remove.
(_GLIBCXX_END_NESTED_NAMESPACE): Remove.
(_GLIBCXX_BEGIN_NAMESPACE_ALGO): Add.
(_GLIBCXX_END_NAMESPACE_ALGO): Add.
(_GLIBCXX_BEGIN_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_END_NAMESPACE_CONTAINER): Add.
(_GLIBCXX_BEGIN_NAMESPACE_VERSION): Add.
(_GLIBCXX_END_NAMESPACE_VERSION): Add.
(_GLIBCXX_BEGIN_LDBL_NAMESPACE): To _GLIBCXX_BEGIN_NAMESPACE_LDBL.
(_GLIBCXX_END_LDBL_NAMESPACE): To _GLIBCXX_END_NAMESPACE_LDBL.
(_GLIBCXX_VISIBILITY_ATTR): Revert to _GLIBCXX_VISIBILITY.
* include/*: Use new macros for namespace scope.
* config/*: Same.
* src/*: Same.
* src/Makefile.am (sources): Remove debug_list.cc, add
compatibility-debug_list-2.cc.
(parallel_sources): Remove parallel_list.cc, add
compatibility-parallel_list-2.cc.
(compatibility-parallel_list-2.[o,lo]): New rule.
* src/Makefile.in: Regenerate.
* src/debug_list.cc: Remove.
* src/parallel_list.cc: Remove.
* src/compatibility-list-2.cc: New.
* src/compatibility-debug_list-2.cc: New.
* src/compatibility-parallel_list-2.cc: New.
* doc/doxygen/user.cfg.in: Adjust macros.
* testsuite/20_util/auto_ptr/assign_neg.cc: Adjust line numbers, macros.
* testsuite/20_util/declval/requirements/1_neg.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same.
* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same.
* testsuite/20_util/forward/c_neg.cc: Same.
* testsuite/20_util/forward/f_neg.cc: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Same.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Same.
* testsuite/20_util/shared_ptr/cons/43820_neg.cc: Same.
* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/forward_list/capacity/1.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
assign_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/forward_list/requirements/dr438/
insert_neg.cc: Same.
* testsuite/23_containers/list/capacity/29134.cc: Same.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
* testsuite/23_containers/vector/bool/capacity/29134.cc: Same.
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Same.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Same.
* testsuite/25_algorithms/sort/35588.cc: Same.
* testsuite/27_io/ios_base/cons/assign_neg.cc: Same.
* testsuite/27_io/ios_base/cons/copy_neg.cc: Same.
* testsuite/ext/profile/mutex_extensions_neg.cc: Same.
* testsuite/ext/profile/profiler_algos.cc: Same.
* testsuite/ext/type_traits/add_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/add_unsigned_integer_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_floating_neg.cc: Same.
* testsuite/ext/type_traits/remove_unsigned_integer_neg.cc: Same.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Same.
From-SVN: r169421
2011-01-30 23:39:36 +01:00
|
|
|
_GLIBCXX_END_NAMESPACE_VERSION
|
|
|
|
} // namespace std
|
2009-11-30 10:34:04 +01:00
|
|
|
|
2012-11-10 18:27:22 +01:00
|
|
|
#endif // C++11
|
2007-03-04 23:59:49 +01:00
|
|
|
|
2007-06-01 01:37:56 +02:00
|
|
|
#endif // _GLIBCXX_FUNCTIONAL
|