From ffeaf689a248da869b6bc8d4fd2233dfe513c060 Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Wed, 28 Jul 2004 03:12:05 +0000 Subject: Gcc 3.4.2 20040728 C++ support bits. --- contrib/libstdc++/include/bits/stl_construct.h | 61 +++++++++++++++----------- 1 file changed, 35 insertions(+), 26 deletions(-) (limited to 'contrib/libstdc++/include/bits/stl_construct.h') diff --git a/contrib/libstdc++/include/bits/stl_construct.h b/contrib/libstdc++/include/bits/stl_construct.h index 685913888c855..afb338798521a 100644 --- a/contrib/libstdc++/include/bits/stl_construct.h +++ b/contrib/libstdc++/include/bits/stl_construct.h @@ -1,6 +1,6 @@ // nonstandard construct and destroy functions -*- C++ -*- -// Copyright (C) 2001, 2002 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. // // 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 @@ -58,8 +58,8 @@ * You should not attempt to use it directly. */ -#ifndef _CPP_BITS_STL_CONSTRUCT_H -#define _CPP_BITS_STL_CONSTRUCT_H 1 +#ifndef _STL_CONSTRUCT_H +#define _STL_CONSTRUCT_H 1 #include #include @@ -72,33 +72,52 @@ namespace std * object's constructor with an initializer. * @endif */ - template + template inline void _Construct(_T1* __p, const _T2& __value) - { new (static_cast(__p)) _T1(__value); } - + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_]allocator::construct + ::new(static_cast(__p)) _T1(__value); + } + /** * @if maint * Constructs an object in existing memory by invoking an allocated * object's default constructor (no initializers). * @endif */ - template + template inline void _Construct(_T1* __p) - { new (static_cast(__p)) _T1(); } + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_]allocator::construct + ::new(static_cast(__p)) _T1(); + } + + /** + * @if maint + * Destroy the object pointed to by a pointer type. + * @endif + */ + template + inline void + _Destroy(_Tp* __pointer) + { __pointer->~_Tp(); } /** * @if maint - * Destroy a range of objects with nontrivial destructors. + * Destroy a range of objects with nontrivial destructors. * * This is a helper function used only by _Destroy(). * @endif */ - template + template inline void - __destroy_aux(_ForwardIterator __first, _ForwardIterator __last, __false_type) - { for ( ; __first != __last; ++__first) _Destroy(&*__first); } + __destroy_aux(_ForwardIterator __first, _ForwardIterator __last, + __false_type) + { for ( ; __first != __last; ++__first) std::_Destroy(&*__first); } /** * @if maint @@ -109,21 +128,11 @@ namespace std * This is a helper function used only by _Destroy(). * @endif */ - template + template inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) { } - /** - * @if maint - * Destroy the object pointed to by a pointer type. - * @endif - */ - template - inline void - _Destroy(_Tp* __pointer) - { __pointer->~_Tp(); } - /** * @if maint * Destroy a range of objects. If the value_type of the object has @@ -131,7 +140,7 @@ namespace std * away, otherwise the objects' destructors must be invoked. * @endif */ - template + template inline void _Destroy(_ForwardIterator __first, _ForwardIterator __last) { @@ -140,9 +149,9 @@ namespace std typedef typename __type_traits<_Value_type>::has_trivial_destructor _Has_trivial_destructor; - __destroy_aux(__first, __last, _Has_trivial_destructor()); + std::__destroy_aux(__first, __last, _Has_trivial_destructor()); } } // namespace std -#endif /* _CPP_BITS_STL_CONSTRUCT_H */ +#endif /* _STL_CONSTRUCT_H */ -- cgit v1.3