Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
memory.h File Reference

Low-level memory allocation routines. More...

#include "Common/assertion.h"
#include <cstddef>
#include <memory>
#include <array>
#include "Common/memory.ipp"

Go to the source code of this file.

Classes

struct  ph::detail::AlignedMemoryDeleter
 
struct  ph::TAlignedArray< T, N, ALIGNMENT_IN_BYTES >
 Aligned version of std::array. This type shares the same traits as std::array. [class.mem] section 20 (https://timsong-cpp.github.io/cppwp/n3337/class.mem#20) supports that the alignment can pass through to the inherited std::array as long as the derived type is also a standard-layout type. More...
 

Namespaces

namespace  ph
 The root for all renderer implementations.
 
namespace  ph::detail
 Implementation detail mainly for internal usages.
 

Typedefs

template<typename T >
using ph::TAlignedMemoryUniquePtr = std::unique_ptr<T, detail::AlignedMemoryDeleter>
 

Functions

void * ph::detail::allocate_aligned_memory (std::size_t numBytes, std::size_t alignmentInBytes)
 
void ph::detail::free_aligned_memory (void *ptr)
 
template<typename T = void>
auto ph::make_aligned_memory (std::size_t numBytes, std::size_t alignmentInBytes) -> TAlignedMemoryUniquePtr< T >
 Create an aligned memory resource.
 
template<typename T >
void ph::from_bytes (const std::byte *srcBytes, T *out_dstValue)
 
template<typename T >
void ph::to_bytes (const T &srcValue, std::byte *out_dstBytes)
 
template<std::size_t N>
void ph::reverse_bytes (std::byte *bytes)
 
template<typename T >
T * ph::start_implicit_lifetime_as (void *ptr) noexcept
 Wrapper for std::start_lifetime_as(). Primarily a fallback when C++23 is not available. This function may touch the storage. For cv overloads or one that does not touch the storage, use std::start_lifetime_as() (requires C++23).
 
template<typename T >
T * ph::start_implicit_lifetime_as_array (void *ptr, std::size_t numArrayElements) noexcept
 Wrapper for std::start_lifetime_as_array(). Primarily a fallback when C++23 is not available. This function may touch the storage. For cv overloads or one that does not touch the storage, use std::start_lifetime_as_array() (requires C++23).
 

Detailed Description

Low-level memory allocation routines.