Blaze 3.9
Destroy.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_UTIL_ALGORITHMS_DESTROY_H_
36#define _BLAZE_UTIL_ALGORITHMS_DESTROY_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <memory>
45#include <blaze/util/Types.h>
46
47
48namespace blaze {
49
50//=================================================================================================
51//
52// DESTROY ALGORITHMS
53//
54//=================================================================================================
55
56//*************************************************************************************************
66template< typename ForwardIt >
67void destroy( ForwardIt first, ForwardIt last )
68{
69 for( ; first!=last; ++first ) {
70 blaze::destroy_at( std::addressof( *first ) );
71 }
72}
73//*************************************************************************************************
74
75
76//*************************************************************************************************
86template< typename ForwardIt >
87void destroy_n( ForwardIt first, size_t n )
88{
89 for( ; n > 0UL; (void) ++first, --n ) {
90 blaze::destroy_at( std::addressof( *first ) );
91 }
92}
93//*************************************************************************************************
94
95} // namespace blaze
96
97#endif
Header file for the generic destroy_at algorithm.
void destroy(ForwardIt first, ForwardIt last)
Destroys the given range of objects .
Definition: Destroy.h:67
void destroy_n(ForwardIt first, size_t n)
Destroys the given range of objects .
Definition: Destroy.h:87
void destroy_at(T *p) noexcept
Destroys the object at the given address.
Definition: DestroyAt.h:57
Header file for basic type definitions.