MySQL 8.0.31
Source Code Documentation
ut0new.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2020, 2022, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/detail/ut0new.h
28 Implementation bits and pieces of include/ut0new.h */
29
30#ifndef detail_ut0new_h
31#define detail_ut0new_h
32
33#include <cstddef>
34#include <utility>
35
40
41namespace ut {
42namespace detail {
43
44template <typename T, typename Tuple, size_t... Args_index_seq>
45inline void construct_impl(void *mem, size_t offset, Tuple &&tuple,
46 std::index_sequence<Args_index_seq...>) {
47 new (reinterpret_cast<uint8_t *>(mem) + offset)
48 T{std::get<Args_index_seq>(std::forward<Tuple>(tuple))...};
49}
50
51template <typename T, typename Tuple>
52inline void construct(void *mem, size_t offset, Tuple &&tuple) {
53 using N_args_seq = std::make_index_sequence<std::tuple_size<Tuple>::value>;
54 construct_impl<T>(mem, offset, tuple, N_args_seq{});
55}
56
57} // namespace detail
58} // namespace ut
59
60#endif /* detail_ut0new_h */
Implementation bits and pieces for aligned allocations.
Implementation bits and pieces for PFS and non-PFS variants for normal allocations and deallocations ...
Implementation bits and pieces for large (huge) page allocations.
Definition: ut0tuple.h:56
void construct_impl(void *mem, size_t offset, Tuple &&tuple, std::index_sequence< Args_index_seq... >)
Definition: ut0new.h:45
void construct(void *mem, size_t offset, Tuple &&tuple)
Definition: ut0new.h:52
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:47
Implementation bits and pieces for page-aligned allocations.
static MEM_ROOT mem
Definition: sql_servers.cc:98