diff options
| author | Alexander Kabaev <kan@FreeBSD.org> | 2004-07-28 03:12:05 +0000 |
|---|---|---|
| committer | Alexander Kabaev <kan@FreeBSD.org> | 2004-07-28 03:12:05 +0000 |
| commit | ffeaf689a248da869b6bc8d4fd2233dfe513c060 (patch) | |
| tree | 75ef0e6da73746d6849e25a0996ae34e1aeff51d /contrib/libstdc++/include/bits/stl_construct.h | |
| parent | 9a63ad9273061dc19cbd117762e365ea9634e241 (diff) | |
Notes
Diffstat (limited to 'contrib/libstdc++/include/bits/stl_construct.h')
| -rw-r--r-- | contrib/libstdc++/include/bits/stl_construct.h | 61 |
1 files changed, 35 insertions, 26 deletions
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 <bits/type_traits.h> #include <new> @@ -72,33 +72,52 @@ namespace std * object's constructor with an initializer. * @endif */ - template <class _T1, class _T2> + template<typename _T1, typename _T2> inline void _Construct(_T1* __p, const _T2& __value) - { new (static_cast<void*>(__p)) _T1(__value); } - + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_]allocator::construct + ::new(static_cast<void*>(__p)) _T1(__value); + } + /** * @if maint * Constructs an object in existing memory by invoking an allocated * object's default constructor (no initializers). * @endif */ - template <class _T1> + template<typename _T1> inline void _Construct(_T1* __p) - { new (static_cast<void*>(__p)) _T1(); } + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_]allocator::construct + ::new(static_cast<void*>(__p)) _T1(); + } + + /** + * @if maint + * Destroy the object pointed to by a pointer type. + * @endif + */ + template<typename _Tp> + 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 <class _ForwardIterator> + template<typename _ForwardIterator> 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,29 +128,19 @@ namespace std * This is a helper function used only by _Destroy(). * @endif */ - template <class _ForwardIterator> + template<typename _ForwardIterator> inline void __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type) { } /** * @if maint - * Destroy the object pointed to by a pointer type. - * @endif - */ - template <class _Tp> - inline void - _Destroy(_Tp* __pointer) - { __pointer->~_Tp(); } - - /** - * @if maint * Destroy a range of objects. If the value_type of the object has * a trivial destructor, the compiler should optimize all of this * away, otherwise the objects' destructors must be invoked. * @endif */ - template <class _ForwardIterator> + template<typename _ForwardIterator> 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 */ |
