4 * Hewlett-Packard Company
6 * Permission to use, copy, modify, distribute and sell this software
7 * and its documentation for any purpose is hereby granted without fee,
8 * provided that the above copyright notice appear in all copies and
9 * that both that copyright notice and this permission notice appear
10 * in supporting documentation. Hewlett-Packard Company makes no
11 * representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
15 * Copyright (c) 1996,1997
16 * Silicon Graphics Computer Systems, Inc.
18 * Permission to use, copy, modify, distribute and sell this software
19 * and its documentation for any purpose is hereby granted without fee,
20 * provided that the above copyright notice appear in all copies and
21 * that both that copyright notice and this permission notice appear
22 * in supporting documentation. Silicon Graphics makes no
23 * representations about the suitability of this software for any
24 * purpose. It is provided "as is" without express or implied warranty.
27 /* NOTE: This is an internal header file, included by other STL headers.
28 * You should not attempt to use it directly.
31 #ifndef __SGI_STL_INTERNAL_CONSTRUCT_H
32 #define __SGI_STL_INTERNAL_CONSTRUCT_H
38 // construct and destroy. These functions are not part of the C++ standard,
39 // and are provided for backward compatibility with the HP STL.
42 inline void destroy(_Tp
* __pointer
) {
46 template <class _T1
, class _T2
>
47 inline void construct(_T1
* __p
, const _T2
& __value
) {
48 new (__p
) _T1(__value
);
52 inline void construct(_T1
* __p
) {
56 template <class _ForwardIterator
>
58 __destroy_aux(_ForwardIterator __first
, _ForwardIterator __last
, __false_type
)
60 for ( ; __first
!= __last
; ++__first
)
64 template <class _ForwardIterator
>
65 inline void __destroy_aux(_ForwardIterator
, _ForwardIterator
, __true_type
) {}
67 template <class _ForwardIterator
, class _Tp
>
69 __destroy(_ForwardIterator __first
, _ForwardIterator __last
, _Tp
*)
71 typedef typename __type_traits
<_Tp
>::has_trivial_destructor
73 __destroy_aux(__first
, __last
, _Trivial_destructor());
76 template <class _ForwardIterator
>
77 inline void destroy(_ForwardIterator __first
, _ForwardIterator __last
) {
78 __destroy(__first
, __last
, __VALUE_TYPE(__first
));
81 inline void destroy(char*, char*) {}
82 inline void destroy(wchar_t*, wchar_t*) {}
86 #endif /* __SGI_STL_INTERNAL_CONSTRUCT_H */