Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
cppgc::AdditionalBytes Struct Reference

#include <allocation.h>

Public Member Functions

constexpr AdditionalBytes (size_t bytes)
 

Public Attributes

const size_t value
 

Detailed Description

Passed to MakeGarbageCollected to specify how many bytes should be appended to the allocated object.

Example:

class InlinedArray final : public GarbageCollected<InlinedArray> {
public:
explicit InlinedArray(size_t bytes) : size(bytes), byte_array(this + 1) {}
void Trace(Visitor*) const {}
size_t size;
char* byte_array;
};
auto* inlined_array = MakeGarbageCollected<InlinedArray(
GetAllocationHandle(), AdditionalBytes(4), 4);
for (size_t i = 0; i < 4; i++) {
Process(inlined_array->byte_array[i]);
}
Definition: garbage-collected.h:53
Definition: visitor.h:56
T * MakeGarbageCollected(AllocationHandle &handle, Args &&... args)
Definition: allocation.h:277
constexpr AdditionalBytes(size_t bytes)
Definition: allocation.h:220

Constructor & Destructor Documentation

◆ AdditionalBytes()

constexpr cppgc::AdditionalBytes::AdditionalBytes ( size_t  bytes)
inlineexplicitconstexpr

Member Data Documentation

◆ value

const size_t cppgc::AdditionalBytes::value

The documentation for this struct was generated from the following file: