/// One of the @link binders binder functors@endlink.
template<typename _Operation, typename _Tp>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::bind")
inline binder1st<_Operation>
bind1st(const _Operation& __fn, const _Tp& __x)
{
/// One of the @link binders binder functors@endlink.
template<typename _Operation, typename _Tp>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::bind")
inline binder2nd<_Operation>
bind2nd(const _Operation& __fn, const _Tp& __x)
{
template<typename _Res, typename... _ArgTypes>
struct _Maybe_unary_or_binary_function { };
+// Ignore warnings about unary_function and binary_function.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// Derives from @c unary_function, as appropriate.
template<typename _Res, typename _T1>
struct _Maybe_unary_or_binary_function<_Res, _T1>
struct _Maybe_unary_or_binary_function<_Res, _T1, _T2>
: std::binary_function<_T1, _T2, _Res> { };
+#pragma GCC diagnostic pop
+
template<typename _Signature>
struct _Mem_fn_traits;
: _Weak_result_type<_Tp>, _Refwrap_base_arg1<_Tp>, _Refwrap_base_arg2<_Tp>
{ };
+// Ignore warnings about unary_function and binary_function.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
// - a function type (unary)
template<typename _Res, typename _T1 _GLIBCXX_NOEXCEPT_PARM>
struct _Reference_wrapper_base<_Res(_T1) _GLIBCXX_NOEXCEPT_QUAL>
{
using result_type = typename _Mem_fn_traits<_MemFunPtr>::__result_type;
};
+#pragma GCC diagnostic pop
#endif // ! C++20
/// @endcond
swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept
{ __a.swap(__b); }
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template<typename _Tp, typename _Tp1>
struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool>
{
operator()(const _Tp1& __lhs, const _Tp& __rhs) const noexcept
{ return __lhs.owner_before(__rhs); }
};
+#pragma GCC diagnostic pop
template<>
struct _Sp_owner_less<void, void>
#endif
};
+// Ignore warnings about std::iterator.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
struct _Bit_iterator_base
: public std::iterator<std::random_access_iterator_tag, bool>
{
+ __x._M_offset - __y._M_offset);
}
};
+#pragma GCC diagnostic pop
struct _Bit_iterator : public _Bit_iterator_base
{
/// @c result_type is the return type
typedef _Result result_type;
- };
+ } _GLIBCXX11_DEPRECATED;
/**
* Helper for defining adaptable binary function objects.
/// @c result_type is the return type
typedef _Result result_type;
- };
+ } _GLIBCXX11_DEPRECATED;
/** @} */
// 20.3.2 arithmetic
struct negate;
#endif
+// Ignore warnings about unary_function and binary_function.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// One of the @link arithmetic_functors math functors@endlink.
template<typename _Tp>
struct plus : public binary_function<_Tp, _Tp, _Tp>
operator()(const _Tp& __x) const
{ return -__x; }
};
+#pragma GCC diagnostic pop
#if __cplusplus > 201103L
struct less_equal;
#endif
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// One of the @link comparison_functors comparison functors@endlink.
template<typename _Tp>
struct equal_to : public binary_function<_Tp, _Tp, bool>
return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y;
}
};
+#pragma GCC diagnostic pop
#if __cplusplus >= 201402L
/// One of the @link comparison_functors comparison functors@endlink.
struct logical_not;
#endif
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// One of the @link logical_functors Boolean operations functors@endlink.
template<typename _Tp>
struct logical_and : public binary_function<_Tp, _Tp, bool>
operator()(const _Tp& __x) const
{ return !__x; }
};
+#pragma GCC diagnostic pop
#if __cplusplus > 201103L
/// One of the @link logical_functors Boolean operations functors@endlink.
struct bit_not;
#endif
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 660. Missing Bitwise Operations.
template<typename _Tp>
operator()(const _Tp& __x) const
{ return ~__x; }
};
+#pragma GCC diagnostic pop
#if __cplusplus > 201103L
template <>
typedef __is_transparent is_transparent;
};
-#endif
+#endif // C++14
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// 20.3.5 negators
/** @defgroup negators Negators
*/
/// One of the @link negators negation functors@endlink.
template<typename _Predicate>
- class unary_negate
+ class _GLIBCXX17_DEPRECATED unary_negate
: public unary_function<typename _Predicate::argument_type, bool>
{
protected:
/// One of the @link negators negation functors@endlink.
template<typename _Predicate>
+ _GLIBCXX17_DEPRECATED_SUGGEST("std::not_fn")
_GLIBCXX14_CONSTEXPR
inline unary_negate<_Predicate>
not1(const _Predicate& __pred)
/// One of the @link negators negation functors@endlink.
template<typename _Predicate>
- class binary_negate
+ class _GLIBCXX17_DEPRECATED binary_negate
: public binary_function<typename _Predicate::first_argument_type,
typename _Predicate::second_argument_type, bool>
{
/// One of the @link negators negation functors@endlink.
template<typename _Predicate>
+ _GLIBCXX17_DEPRECATED_SUGGEST("std::not_fn")
_GLIBCXX14_CONSTEXPR
inline binary_negate<_Predicate>
not2(const _Predicate& __pred)
_Result
operator()(_Arg __x) const
{ return _M_ptr(__x); }
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link pointer_adaptors adaptors for function pointers@endlink.
template<typename _Arg, typename _Result>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline pointer_to_unary_function<_Arg, _Result>
ptr_fun(_Result (*__x)(_Arg))
{ return pointer_to_unary_function<_Arg, _Result>(__x); }
_Result
operator()(_Arg1 __x, _Arg2 __y) const
{ return _M_ptr(__x, __y); }
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link pointer_adaptors adaptors for function pointers@endlink.
template<typename _Arg1, typename _Arg2, typename _Result>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline pointer_to_binary_function<_Arg1, _Arg2, _Result>
ptr_fun(_Result (*__x)(_Arg1, _Arg2))
{ return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); }
private:
_Ret (_Tp::*_M_f)();
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp>
private:
_Ret (_Tp::*_M_f)() const;
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp>
private:
_Ret (_Tp::*_M_f)();
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp>
private:
_Ret (_Tp::*_M_f)() const;
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp, typename _Arg>
private:
_Ret (_Tp::*_M_f)(_Arg);
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp, typename _Arg>
private:
_Ret (_Tp::*_M_f)(_Arg) const;
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp, typename _Arg>
private:
_Ret (_Tp::*_M_f)(_Arg);
- };
+ } _GLIBCXX11_DEPRECATED;
/// One of the @link ptrmem_adaptors adaptors for member pointers@endlink.
template<typename _Ret, typename _Tp, typename _Arg>
private:
_Ret (_Tp::*_M_f)(_Arg) const;
- };
+ } _GLIBCXX11_DEPRECATED;
// Mem_fun adaptor helper functions. There are only two:
// mem_fun and mem_fun_ref.
template<typename _Ret, typename _Tp>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline mem_fun_t<_Ret, _Tp>
mem_fun(_Ret (_Tp::*__f)())
{ return mem_fun_t<_Ret, _Tp>(__f); }
template<typename _Ret, typename _Tp>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline const_mem_fun_t<_Ret, _Tp>
mem_fun(_Ret (_Tp::*__f)() const)
{ return const_mem_fun_t<_Ret, _Tp>(__f); }
template<typename _Ret, typename _Tp>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline mem_fun_ref_t<_Ret, _Tp>
mem_fun_ref(_Ret (_Tp::*__f)())
{ return mem_fun_ref_t<_Ret, _Tp>(__f); }
template<typename _Ret, typename _Tp>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline const_mem_fun_ref_t<_Ret, _Tp>
mem_fun_ref(_Ret (_Tp::*__f)() const)
{ return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
template<typename _Ret, typename _Tp, typename _Arg>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template<typename _Ret, typename _Tp, typename _Arg>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline const_mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template<typename _Ret, typename _Tp, typename _Arg>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
template<typename _Ret, typename _Tp, typename _Arg>
+ _GLIBCXX11_DEPRECATED_SUGGEST("std::mem_fn")
inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+#pragma GCC diagnostic pop
/** @} */
}
#endif
+// Ignore warnings about std::iterator.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
// 24.4.1 Reverse iterators
/**
* Bidirectional and random access iterators have corresponding reverse
{ return *this; }
};
+#pragma GCC diagnostic pop
+
/**
* @param __x A container of arbitrary type.
* @param __i An iterator into the container.
*/
template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
typename _Pointer = _Tp*, typename _Reference = _Tp&>
- struct iterator
+ struct _GLIBCXX17_DEPRECATED iterator
{
/// One of the @link iterator_tags tag types@endlink.
typedef _Category iterator_category;
#endif
public:
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
class value_compare
: public std::binary_function<value_type, value_type, bool>
{
bool operator()(const value_type& __x, const value_type& __y) const
{ return comp(__x.first, __y.first); }
};
+#pragma GCC diagnostic pop
private:
/// This turns a red-black tree into a [multi]map.
#endif
public:
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
class value_compare
: public std::binary_function<value_type, value_type, bool>
{
bool operator()(const value_type& __x, const value_type& __y) const
{ return comp(__x.first, __y.first); }
};
+#pragma GCC diagnostic pop
private:
/// This turns a red-black tree into a [multi]map.
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+// Ignore warnings about std::iterator.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/**
* This iterator class lets algorithms store their results into
* uninitialized memory.
*/
template <class _OutputIterator, class _Tp>
- class raw_storage_iterator
+ class _GLIBCXX17_DEPRECATED raw_storage_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
protected:
// 2454. Add raw_storage_iterator::base() member
_OutputIterator base() const { return _M_iter; }
};
+#pragma GCC diagnostic pop
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
* Provides the nothrow exception guarantee.
*/
template<typename _Tp>
+ _GLIBCXX14_DEPRECATED
pair<_Tp*, ptrdiff_t>
get_temporary_buffer(ptrdiff_t __len) _GLIBCXX_NOEXCEPT
{
* @{
*/
+// Ignore warnings about std::iterator.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// Provides input iterator semantics for streams.
template<typename _Tp, typename _CharT = char,
typename _Traits = char_traits<_CharT>, typename _Dist = ptrdiff_t>
operator++(int) _GLIBCXX_NOEXCEPT
{ return *this; }
};
+#pragma GCC diagnostic pop
/// @} group iterators
* @{
*/
+// Ignore warnings about std::iterator.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// 24.5.3 Template class istreambuf_iterator
/// Provides input iterator semantics for streambufs.
template<typename _CharT, typename _Traits>
return *this;
}
};
+#pragma GCC diagnostic pop
// Overloads for streambuf iterators.
template<typename _CharT>
// _Tp should be a pointer type.
template<typename _Tp>
class _Inclusive_between
- : public std::unary_function<typename std::pair<_Tp, _Tp>, bool>
{
typedef _Tp pointer;
pointer _M_ptr_value;
// Used to pass a Functor to functions by reference.
template<typename _Functor>
class _Functor_Ref
- : public std::unary_function<typename _Functor::argument_type,
- typename _Functor::result_type>
{
_Functor& _M_fref;
// the vector.
template<typename _Tp>
class _Ffit_finder
- : public std::unary_function<typename std::pair<_Tp, _Tp>, bool>
{
- typedef typename std::pair<_Tp, _Tp> _Block_pair;
- typedef typename __detail::__mini_vector<_Block_pair> _BPVector;
+ typedef std::pair<_Tp, _Tp> _Block_pair;
+ typedef __detail::__mini_vector<_Block_pair> _BPVector;
typedef typename _BPVector::difference_type _Counter_type;
std::size_t* _M_pbitmap;
_Counter_type _M_data_offset;
public:
+ typedef bool result_type;
+ typedef _Block_pair argument_type;
+
_Ffit_finder() : _M_pbitmap(0), _M_data_offset(0)
{ }
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/** The @c identity_element functions are not part of the C++
* standard; SGI provided them as an extension. Its argument is an
* operation, and its return value is the identity element for that
{ _M_initialize(161803398u); }
};
+#pragma GCC diagnostic pop
+
// Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,
// provided for backward compatibility, they are no longer part of
// the C++ standard.
// behave a little like basic_ostringstream<sequence::value_type> and a
// little like containers.
+// Ignore warnings about std::iterator.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
template<class _Sequence, std::size_t _Buf_sz = 100>
class sequence_buffer
: public std::iterator<std::output_iterator_tag, void, void, void, void>
operator++(int)
{ return *this; }
};
+#pragma GCC diagnostic pop
// The following should be treated as private, at least for now.
template<class _CharT>
// Some helpers, so we can use power on ropes.
// See below for why this isn't local to the implementation.
-
+
+// Ignore warnings about std::binary_function.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// This uses a nonstandard refcount convention.
// The result has refcount 0.
template<class _CharT, class _Alloc>
const rope<_CharT, _Alloc>& __y)
{ return __x + __y; }
};
+#pragma GCC diagnostic pop
template <class _CharT, class _Alloc>
inline rope<_CharT, _Alloc>
// Iterators are assumed to be thread private. Ropes can
// be shared.
+// Ignore warnings about std::iterator
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template<class _CharT, class _Alloc>
class _Rope_iterator_base
: public std::iterator<std::random_access_iterator_tag, _CharT>
}
}
};
+#pragma GCC diagnostic pop
template<class _CharT, class _Alloc>
class _Rope_iterator;
namespace std _GLIBCXX_VISIBILITY(default)
{
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// Explicit specialization of std::hash for __gnu_cxx::throw_value_limit.
template<>
struct hash<__gnu_cxx::throw_value_limit>
}
};
#endif
+
+#pragma GCC diagnostic pop
} // end namespace std
#endif
template<typename _Functor, typename... _ArgTypes>
struct result_of<_Functor(_ArgTypes...)>
: public __invoke_result<_Functor, _ArgTypes...>
- { };
+ { } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result");
#if __cplusplus >= 201402L
/// Alias template for aligned_storage
typedef void type;
};
+// Ignore warnings about std::unary_function and std::binary_function.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// Determines if the type _Tp derives from unary_function.
template<typename _Tp>
struct _Derives_from_unary_function : __sfinae_types
typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
_Invoker_type _M_invoker;
};
+#pragma GCC diagnostic pop
template<typename _Res, typename... _ArgTypes>
function<_Res(_ArgTypes...)>::
namespace tr1
{
+// Ignore warnings about std::unary_function and std::binary_function.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/// Class template hash.
// Declaration of default hash functor std::tr1::hash. The types for
// which std::tr1::hash<T> is well-defined is in clause 6.3.3. of the PDTR.
operator()(_Tp* __p) const
{ return reinterpret_cast<size_t>(__p); }
};
+#pragma GCC diagnostic pop
/// Explicit specializations for integer types.
#define _TR1_hashtable_define_trivial_hash(_Tp) \
// 20.3.6 Binders
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
#include <functional>
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-add-options using-deprecated }
// 20.3.6 Binders
static_assert(std::bit_xor<void>()(1,1)==0, "");
static_assert(std::bit_not<void>()(std::bit_not<void>()(0))==0, "");
-static_assert(std::unary_negate<std::logical_not<int>>
- (std::logical_not<int>())(1), "");
-static_assert(std::not1(std::logical_not<int>())(1), "");
+static_assert(std::unary_negate< // { dg-warning "is deprecated" "" { target c++17 } }
+ std::logical_not<int>
+ >(std::logical_not<int>())(1), "");
+static_assert(std::not1(std::logical_not<int>())(1), ""); // { dg-warning "is deprecated" "" { target c++17 } }
-static_assert(std::binary_negate<std::logical_and<int>>
- (std::logical_and<int>())(0,0), "");
-static_assert(std::not2(std::logical_and<int>())(0,0), "");
+static_assert(std::binary_negate< // { dg-warning "is deprecated" "" { target c++17 } }
+ std::logical_and<int>
+ >(std::logical_and<int>())(0,0), "");
+static_assert(std::not2(std::logical_and<int>())(0,0), ""); // { dg-warning "is deprecated" "" { target c++17 } }
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// { dg-do run { target c++11 } }
+// { dg-do run }
#include <memory>
#include <testsuite_hooks.h>
test01()
{
int a[2];
- auto it = std::raw_storage_iterator<int*, int>(a);
+ std::raw_storage_iterator<int*, int> it(a); // { dg-warning "is deprecated" "" { target c++17 } }
VERIFY( it.base() == a );
VERIFY( (++it).base() == a+1 );
}
{
char buf[sizeof(MoveOnly)*2];
MoveOnly* addr = (MoveOnly*)buf;
- std::raw_storage_iterator<MoveOnly*, MoveOnly> iter(addr);
+ std::raw_storage_iterator<MoveOnly*, MoveOnly> iter(addr); // { dg-warning "is deprecated" "" { target c++17 } }
*iter++ = MoveOnly{1};
*iter++ = MoveOnly{2};
VERIFY( addr[0].i == 1 );
// Check for required base class.
long l;
- typedef raw_storage_iterator<long*, long> test_iterator;
- typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ typedef raw_storage_iterator<long*, long> test_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
test_iterator rs_it(&l);
base_iterator* base __attribute__((unused)) = &rs_it;
}
#include <memory>
-template class std::raw_storage_iterator<int*, int>;
+template class std::raw_storage_iterator<int*, int>; // { dg-warning "is deprecated" "" { target c++17 } }
using namespace std;
// Check for required typedefs
- typedef raw_storage_iterator<long*, long> test_iterator;
+ typedef raw_storage_iterator<long*, long> test_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
typedef test_iterator::value_type value_type;
typedef test_iterator::difference_type difference_type;
typedef test_iterator::pointer pointer;
int cmember2(char)const;
};
-struct functor1 : public std::unary_function<int, double>
+struct functor1 : public std::unary_function<int, double> // { dg-warning "is deprecated" }
{
double operator()(int) const;
};
-struct functor2 : public std::binary_function<int, char, double>
+struct functor2 : public std::binary_function<int, char, double> // { dg-warning "is deprecated" }
{
double operator()(int, char) const;
};
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
-// { dg-skip-if "result_type removed for C++20" { c++2a } }
// Copyright (C) 2008-2022 Free Software Foundation, Inc.
//
#include <functional>
#include <type_traits>
+namespace __gnu_test
+{
+
+template<typename T> using void_t = void;
+
+struct none;
+
+#if __cplusplus <= 201703L
+// For C++11/14/17 if the nested type is not found, require
+// that the test used 'none' as the expected type.
+template<typename U> using not_found = std::is_same<U, none>;
+// A nested type needs to match the expected type.
+template<typename U, typename V> using found = std::is_same<U, V>;
+#else
+// For C++20 the nested type should always be not found.
+template<typename U> using not_found = std::true_type;
+// Any nested type is bad.
+template<typename U, typename V> using found = std::false_type;
+#endif
+
+template<typename T, typename U, typename = void>
+struct check_result_type
+: not_found<U>
+{ };
+
+// Matches when reference_wrapper<T>::result_type exists
+template<typename T, typename U>
+struct check_result_type<T, U, void_t<typename std::reference_wrapper<T>::result_type>>
+: found<U, typename std::reference_wrapper<T>::result_type>
+{ };
+
+template<typename T, typename U, typename = void>
+struct check_arg_type
+: not_found<U>
+{ };
+
+// Matches when reference_wrapper<T>::argument_type exists
+template<typename T, typename U>
+struct check_arg_type<T, U, void_t<typename std::reference_wrapper<T>::argument_type>>
+: found<U, typename std::reference_wrapper<T>::argument_type>
+{ };
+
+template<typename T, typename U, typename = void>
+struct check_first_arg_type
+: not_found<U>
+{ };
+
+// Matches when reference_wrapper<T>::first_argument_type exists
+template<typename T, typename U>
+struct check_first_arg_type<T, U, void_t<typename std::reference_wrapper<T>::first_argument_type>>
+: found<U, typename std::reference_wrapper<T>::first_argument_type>
+{ };
+
+template<typename T, typename U, typename = void>
+struct check_second_arg_type
+: not_found<U>
+{ };
+
+// Matches when reference_wrapper<T>::second_argument_type exists
+template<typename T, typename U>
+struct check_second_arg_type<T, U, void_t<typename std::reference_wrapper<T>::second_argument_type>>
+: found<U, typename std::reference_wrapper<T>::second_argument_type>
+{ };
+
+} // namespace __gnu_test
+
struct X {};
struct int_result_type { typedef int result_type; };
void test01()
{
- using std::reference_wrapper;
using std::is_same;
+ using __gnu_test::check_result_type;
+ using __gnu_test::none;
// Check result_type typedef
- static_assert( is_same<reference_wrapper<int_result_type>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<derives_unary>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<derives_binary>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<derives_unary_binary>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<int(void)>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<int(*)(void)>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<int (::X::*)()>::result_type, int>::value, "has result_type" );
- static_assert( is_same<reference_wrapper<int (::X::*)(float)>::result_type, int>::value, "has result_type" );
+ static_assert( check_result_type<int_result_type, int>::value, "has result_type" );
+ static_assert( check_result_type<derives_unary, int>::value, "has result_type" );
+ static_assert( check_result_type<derives_binary, int>::value, "has result_type" );
+ static_assert( check_result_type<derives_unary_binary, int>::value, "has result_type" );
+ static_assert( check_result_type<int(void), int>::value, "has result_type" );
+ static_assert( check_result_type<int(*)(void), int>::value, "has result_type" );
+ static_assert( check_result_type<int (::X::*)(), int>::value, "has result_type" );
+ static_assert( check_result_type<int (::X::*)(float), int>::value, "has result_type" );
+}
+
+void test02()
+{
+ using __gnu_test::check_arg_type;
+ using __gnu_test::check_first_arg_type;
+ using __gnu_test::check_second_arg_type;
+ using __gnu_test::none;
+
+ // Check argument_type typedef
+ static_assert( check_arg_type<int_result_type, none>::value, "" );
+ static_assert( check_arg_type<derives_unary, int>::value, "" );
+ static_assert( check_arg_type<derives_binary, none>::value, "" );
+ static_assert( check_arg_type<derives_unary_binary, int>::value, "" );
+ static_assert( check_arg_type<int(void), none>::value, "" );
+ static_assert( check_arg_type<int(*)(void), none>::value, "" );
+ static_assert( check_arg_type<int (::X::*)(), X*>::value, "" );
+ static_assert( check_arg_type<int (::X::*)() const, const X*>::value, "" );
+ static_assert( check_arg_type<int (::X::*)(float), none>::value, "" );
+ static_assert( check_arg_type<int (::X::*)(char, char), none>::value, "" );
+
+ // Check first_argument_type typedef
+ static_assert( check_first_arg_type<int_result_type, none>::value, "" );
+ static_assert( check_first_arg_type<derives_unary, none>::value, "" );
+ static_assert( check_first_arg_type<derives_binary, int>::value, "" );
+ static_assert( check_first_arg_type<derives_unary_binary, int>::value, "" );
+ static_assert( check_first_arg_type<int(void), none>::value, "" );
+ static_assert( check_first_arg_type<int(*)(void), none>::value, "" );
+ static_assert( check_first_arg_type<int (::X::*)(), none>::value, "" );
+ static_assert( check_first_arg_type<int (::X::*)(float), X*>::value, "" );
+ static_assert( check_first_arg_type<int (::X::*)(float) const, const X*>::value, "" );
+ static_assert( check_first_arg_type<int (::X::*)(char, char), none>::value, "" );
+
+ // Check second_argument_type typedef
+ static_assert( check_second_arg_type<int_result_type, none>::value, "" );
+ static_assert( check_second_arg_type<derives_unary, none>::value, "" );
+ static_assert( check_second_arg_type<derives_binary, float>::value, "" );
+ static_assert( check_second_arg_type<derives_unary_binary, float>::value, "" );
+ static_assert( check_second_arg_type<int(void), none>::value, "" );
+ static_assert( check_second_arg_type<int(*)(void), none>::value, "" );
+ static_assert( check_second_arg_type<int (::X::*)(), none>::value, "" );
+ static_assert( check_second_arg_type<int (::X::*)(float), float>::value, "" );
+ static_assert( check_second_arg_type<int (::X::*)(float) const, float>::value, "" );
+ static_assert( check_second_arg_type<int (::X::*)(char, char), none>::value, "" );
}
int main()
{
test01();
- return 0;
}
namespace std
{
template<>
- struct less<A*> : binary_function<A*,A*,bool>
+ struct less<A*>
{
static int count;
bool operator()(A* l, A* r) { ++count; return l < r; }
int main(void)
{
typedef std::pair<junk*, std::ptrdiff_t> pair_type;
- pair_type results = std::get_temporary_buffer<junk>(5);
+ pair_type results = std::get_temporary_buffer<junk>(5); // { dg-warning "deprecated" "" { target c++14 } }
if (results.second != 0)
{
#include <string>
#include <iterator>
-struct hate_T_iterator : std::iterator<std::forward_iterator_tag, char> {
+struct hate_T_iterator {
+
+ typedef std::forward_iterator_tag iterator_category;
+ typedef char value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef char* pointer;
+ typedef char& reference;
+
explicit hate_T_iterator(char* p) : p(p) {}
char* p;
// Check for required base class.
list<int> l;
typedef back_insert_iterator<list<int> > test_iterator;
- typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
test_iterator r_it(l);
base_iterator* base __attribute__((unused)) = &r_it;
}
// Check for required base class.
list<int> l;
typedef front_insert_iterator<list<int> > test_iterator;
- typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
test_iterator r_it(l);
base_iterator* base __attribute__((unused)) = &r_it;
}
list<int>::iterator li = l.begin();
typedef insert_iterator<list<int> > test_iterator;
- typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
test_iterator r_it(l, li);
base_iterator* base __attribute__((unused)) = &r_it;
}
// Check for required base class.
typedef istream_iterator<long> test_iterator;
- typedef iterator<input_iterator_tag, long, ptrdiff_t, const long*,
+ typedef iterator<input_iterator_tag, long, ptrdiff_t, const long*, // { dg-warning "is deprecated" "" { target c++17 } }
const long&> base_iterator;
test_iterator r_it;
base_iterator* base __attribute__((unused)) = &r_it;
typedef std::input_iterator_tag category;
typedef std::char_traits<char>::off_type off_type;
-typedef std::iterator<category, char, off_type, char*, char> good;
-typedef std::iterator<category, char, off_type, char*, char&> bad;
+typedef std::iterator<category, char, off_type, char*, char> good; // { dg-warning "is deprecated" "" { target c++17 } }
+typedef std::iterator<category, char, off_type, char*, char&> bad; // { dg-warning "is deprecated" "" { target c++17 } }
bool check(good&) { return true; }
void check(bad&) { }
typedef istreambuf_iterator<char> test_iterator;
typedef char_traits<char>::off_type off_type;
- // This is the base class required since LWG 445, which differs from C++03:
- typedef iterator<input_iterator_tag, char, off_type, char*, char>
+ // This is the base class required since LWG 445, which differs from C++03.
+ // We derive from this unconditionally, then override 'reference' for C++03.
+ typedef iterator<input_iterator_tag, char, off_type, char*, char> // { dg-warning "is deprecated" "" { target c++17 } }
base_iterator;
istringstream isstream("this tag");
// Check for required base class.
typedef ostream_iterator<long> test_iterator;
- typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
ostringstream osstream("this tag");
test_iterator r_it(osstream);
base_iterator* base __attribute__((unused)) = &r_it;
// Check for required base class.
typedef ostreambuf_iterator<char> test_iterator;
- typedef iterator<output_iterator_tag, void, void, void, void> base_iterator;
+ typedef iterator<output_iterator_tag, void, void, void, void> base_iterator; // { dg-warning "is deprecated" "" { target c++17 } }
ostringstream osstream("this tag");
test_iterator r_it(osstream);
base_iterator* base __attribute__((unused)) = &r_it;
// Check for required base class.
long l;
typedef reverse_iterator<long*> test_iterator;
- typedef iterator<iterator_traits<long*>::iterator_category,
+ typedef iterator<iterator_traits<long*>::iterator_category, // { dg-warning "is deprecated" "" { target c++17 } }
iterator_traits<long*>::value_type,
iterator_traits<long*>::difference_type,
iterator_traits<long*>::pointer,
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool all_of(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool all_of(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool any_of(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool any_of(iterator_type, iterator_type, predicate_type);
-}
+}
#include <testsuite_hooks.h>
class Counting_output_iterator
-: public std::iterator< std::output_iterator_tag, void, void, void, void >
+: public std::iterator< std::output_iterator_tag, void, void, void, void > // { dg-warning "is deprecated" "" { target c++17 } }
{
std::size_t c;
public:
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-24 Paolo Carlini <paolo.carlini@oracle.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type copy_if(iterator_type, iterator_type,
+ template iterator_type copy_if(iterator_type, iterator_type,
iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-24 Paolo Carlini <paolo.carlini@oracle.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type copy_if(iterator_type, iterator_type,
+ template iterator_type copy_if(iterator_type, iterator_type,
iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template difference_type count_if(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template difference_type count_if(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template iterator_type find_end(iterator_type, iterator_type,
iterator_type, iterator_type,
predicate_type);
-}
+}
// { dg-do compile }
+// { dg-additional-options "-Wno-deprecated-declarations" { target c++11 } }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template iterator_type find_end(iterator_type, iterator_type,
iterator_type, iterator_type,
predicate_type);
-}
+}
// { dg-do compile }
+// { dg-additional-options "-Wno-deprecated-declarations" { target c++11 } }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template iterator_type find_first_of(iterator_type, iterator_type,
iterator_type, iterator_type,
predicate_type);
-}
+}
// { dg-do compile }
+// { dg-additional-options "-Wno-deprecated-declarations" { target c++11 } }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template iterator_type find_first_of(iterator_type, iterator_type,
iterator_type, iterator_type,
predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type find_if(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type find_if(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type find_if_not(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type find_if_not(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, void> function_type;
- template function_type for_each(iterator_type, iterator_type,
+ template function_type for_each(iterator_type, iterator_type,
function_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, void> function_type;
- template function_type for_each(iterator_type, iterator_type,
+ template function_type for_each(iterator_type, iterator_type,
function_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-27 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool is_partitioned(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-27 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool is_partitioned(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2011-01-13 Paolo Carlini <paolo.carlini@oracle.com>
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2011-01-13 Paolo Carlini <paolo.carlini@oracle.com>
#include <testsuite_hooks.h>
struct compare_counter
- : std::binary_function<int, int, bool>
{
+ typedef int result_type;
+ typedef int first_argument_type;
+ typedef bool second_argument_type;
+
static int count;
bool operator()(int a, int b) const
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool none_of(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-25 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template bool none_of(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template iterator_type partition(iterator_type, iterator_type,
predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template iterator_type partition(iterator_type, iterator_type,
predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-26 Paolo Carlini <paolo.carlini@oracle.com>
template pair<iterator_type, iterator_type>
partition_copy(iterator_type, iterator_type,
iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-26 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template pair<iterator_type, iterator_type>
- partition_copy(iterator_type, iterator_type,
+ partition_copy(iterator_type, iterator_type,
iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-28 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type partition_point(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile { target c++11 } }
// 2008-06-28 Paolo Carlini <paolo.carlini@oracle.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type partition_point(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// { dg-add-options using-deprecated }
// { dg-do compile }
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-add-options using-deprecated }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type remove_copy_if(iterator_type, iterator_type,
+ template iterator_type remove_copy_if(iterator_type, iterator_type,
iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type remove_copy_if(iterator_type, iterator_type,
+ template iterator_type remove_copy_if(iterator_type, iterator_type,
iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type remove_if(iterator_type, iterator_type,
+ template iterator_type remove_if(iterator_type, iterator_type,
predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type remove_if(iterator_type, iterator_type,
+ template iterator_type remove_if(iterator_type, iterator_type,
predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type replace_copy_if(iterator_type, iterator_type,
+ template iterator_type replace_copy_if(iterator_type, iterator_type,
iterator_type, predicate_type,
const value_type&);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
- template iterator_type replace_copy_if(iterator_type, iterator_type,
+ template iterator_type replace_copy_if(iterator_type, iterator_type,
iterator_type, predicate_type,
const value_type&);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template void replace_if(iterator_type, iterator_type, predicate_type,
const value_type&);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
template void replace_if(iterator_type, iterator_type, predicate_type,
const value_type&);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type;
- template iterator_type search(iterator_type, iterator_type,
+ template iterator_type search(iterator_type, iterator_type,
iterator_type, iterator_type);
- template iterator_type search(iterator_type, iterator_type,
+ template iterator_type search(iterator_type, iterator_type,
iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef value_type* iterator_type;
typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type;
- template iterator_type search(iterator_type, iterator_type,
+ template iterator_type search(iterator_type, iterator_type,
iterator_type, iterator_type);
- template iterator_type search(iterator_type, iterator_type,
+ template iterator_type search(iterator_type, iterator_type,
iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::size_t size_type;
typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type;
- template iterator_type search_n(iterator_type, iterator_type,
+ template iterator_type search_n(iterator_type, iterator_type,
size_type, const value_type&);
- template iterator_type search_n(iterator_type, iterator_type,
+ template iterator_type search_n(iterator_type, iterator_type,
size_type, const value_type&, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::size_t size_type;
typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type;
- template iterator_type search_n(iterator_type, iterator_type,
+ template iterator_type search_n(iterator_type, iterator_type,
size_type, const value_type&);
- template iterator_type search_n(iterator_type, iterator_type,
+ template iterator_type search_n(iterator_type, iterator_type,
size_type, const value_type&, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type stable_partition(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
typedef std::pointer_to_unary_function<value_type, bool> predicate_type;
template iterator_type stable_partition(iterator_type, iterator_type, predicate_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
operator1_type);
template iterator_type transform(iterator_type, iterator_type, iterator_type,
iterator_type, operator2_type);
-}
+}
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com>
operator1_type);
template iterator_type transform(iterator_type, iterator_type, iterator_type,
iterator_type, operator2_type);
-}
+}
{
transform(tmpstr.begin(), tmpstr.end(),
back_inserter(str1),
- bind1st(std::mem_fun(&std::wios::widen), &stream));
+ bind1st(std::mem_fun(&std::wios::widen), &stream)); // { dg-warning "is deprecated" "" { target c++11 } }
}
fbuf1.sputn(str1.data(), str1.size());
// Now we erase all values that satisfy some predicate, in this case
// one that returns true for all those larger than 500.
- p.erase_if(bind1st(less<int>(), 500));
+ p.erase_if(bind1st(less<int>(), 500)); // { dg-warning "is deprecated" "" { target c++11 } }
// The largest value should be now 500.
assert(p.top() == 500);
cout <<* it << endl;
// Now split the queues.
- even_p.split(bind2nd(modulus<int>(), 2), odd_p);
+ even_p.split(bind2nd(modulus<int>(), 2), odd_p); // { dg-warning "is deprecated" "" { target c++11 } }
// Check that each one contains the appropriate 10 values.
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-options "-Wno-deprecated-declarations" }
+
// 2.1 reference wrappers
#include <tr1/functional>
#include <tr1/type_traits>
+// { dg-options "-Wno-deprecated-declarations" }
// { dg-do compile }
// Copyright (C) 2007-2022 Free Software Foundation, Inc.
{
template<typename T>
struct regression_test_erase_if_fn
- : public std::unary_function<T, bool>
{
private:
typedef const T& const_reference;
public:
+ typedef bool result_type;
+ typedef T argument_type;
+
bool
operator()(const_reference r_t) const
{
template<typename Hd, class Tl>
struct regression_test_erase_if_fn<std::pair<Hd, Tl> >
- : public std::unary_function<std::pair<Hd, Tl>, bool>
{
private:
typedef const std::pair<Hd, Tl>& const_reference;
typedef regression_test_erase_if_fn<Tl> tl_erase_if_fn;
public:
+ typedef bool result_type;
+ typedef std::pair<Hd, Tl> argument_type;
+
bool
operator()(const_reference r_t) const
{
*/
template<class T>
struct output_iterator_wrapper
- : public std::iterator<std::output_iterator_tag, void, std::ptrdiff_t, void, void>
{
protected:
output_iterator_wrapper() : ptr(0), SharedInfo(0)
{ }
public:
+ typedef std::output_iterator_tag iterator_category;
+ typedef T value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef T& reference;
+
typedef OutputContainer<T> ContainerType;
T* ptr;
ContainerType* SharedInfo;
*/
template<class T>
class input_iterator_wrapper
- : public std::iterator<std::input_iterator_tag, typename remove_cv<T>::type,
- std::ptrdiff_t, T*, T&>
{
struct post_inc_proxy
{
{ }
public:
+ typedef std::input_iterator_tag iterator_category;
+ typedef typename remove_cv<T>::type value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef T& reference;
+
typedef BoundsContainer<T> ContainerType;
T* ptr;
ContainerType* SharedInfo;