Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-30 08:46:14

0001 /*
0002     Copyright (c) 2005-2021 Intel Corporation
0003 
0004     Licensed under the Apache License, Version 2.0 (the "License");
0005     you may not use this file except in compliance with the License.
0006     You may obtain a copy of the License at
0007 
0008         http://www.apache.org/licenses/LICENSE-2.0
0009 
0010     Unless required by applicable law or agreed to in writing, software
0011     distributed under the License is distributed on an "AS IS" BASIS,
0012     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013     See the License for the specific language governing permissions and
0014     limitations under the License.
0015 */
0016 #ifndef __TBB_aligned_space_H
0017 #define __TBB_aligned_space_H
0018 
0019 #include <cstddef>
0020 
0021 #include "_template_helpers.h"
0022 
0023 namespace tbb {
0024 namespace detail {
0025 inline namespace d0 {
0026 
0027 //! Block of space aligned sufficiently to construct an array T with N elements.
0028 /** The elements are not constructed or destroyed by this class.
0029     @ingroup memory_allocation */
0030 template<typename T, std::size_t N = 1>
0031 class aligned_space {
0032     alignas(alignof(T)) std::uint8_t aligned_array[N * sizeof(T)];
0033 
0034 public:
0035     //! Pointer to beginning of array
0036     T* begin() const { return punned_cast<T*>(&aligned_array); }
0037 
0038     //! Pointer to one past last element in array.
0039     T* end() const { return begin() + N; }
0040 };
0041 
0042 } // namespace d0
0043 } // namespace detail
0044 } // namespace tbb
0045 
0046 #endif /* __TBB_aligned_space_H */