Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkAlignedStorage.h
Go to the documentation of this file.
1// Copyright 2022 Google LLC
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3
4#ifndef SkAlignedStorage_DEFINED
5#define SkAlignedStorage_DEFINED
6
7#include <cstddef>
8#include <iterator>
9
10template <int N, typename T> class SkAlignedSTStorage {
11public:
17
18 // Returns void* because this object does not initialize the
19 // memory. Use placement new for types that require a constructor.
20 void* get() { return fStorage; }
21 const void* get() const { return fStorage; }
22
23 // Act as a container of bytes because the storage is uninitialized.
24 std::byte* data() { return fStorage; }
25 const std::byte* data() const { return fStorage; }
26 size_t size() const { return std::size(fStorage); }
27
28private:
29 alignas(T) std::byte fStorage[sizeof(T) * N];
30};
31
32#endif // SkAlignedStorage_DEFINED
#define N
Definition beziers.cpp:19
const std::byte * data() const
const void * get() const
SkAlignedSTStorage & operator=(const SkAlignedSTStorage &)=delete
SkAlignedSTStorage(SkAlignedSTStorage &&)=delete
size_t size() const
SkAlignedSTStorage(const SkAlignedSTStorage &)=delete
SkAlignedSTStorage & operator=(SkAlignedSTStorage &&)=delete
#define T