OGLplus  (0.59.0) a C++ wrapper for rendering APIs

null_ptr.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_MEMORY_NULL_PTR_HPP
10 #define EAGINE_MEMORY_NULL_PTR_HPP
11 
12 #include "../types.hpp"
13 #include <cstdint>
14 
15 namespace eagine::memory {
16 //------------------------------------------------------------------------------
20 template <typename T>
21 struct typed_nullptr_t {};
22 //------------------------------------------------------------------------------
25 template <typename T>
27 //------------------------------------------------------------------------------
30 template <typename T, typename N>
31 static constexpr auto operator+(typed_nullptr_t<T>, N n) noexcept -> T* {
32  return reinterpret_cast<T*>(std::uintptr_t(std_size(n) * sizeof(T)));
33 }
34 //------------------------------------------------------------------------------
35 } // namespace eagine::memory
36 
37 #endif // EAGINE_MEMORY_NULL_PTR_HPP
Class for doing pointer arithmetic on null pointers.
Definition: null_ptr.hpp:21
constexpr typed_nullptr_t< T > typed_nullptr
Template constant for doing pointer arithmetic on null pointers.
Definition: null_ptr.hpp:26
static auto operator+(const fixed_size_string< N1 > &s1, const fixed_size_string< N2 > &s2) noexcept
Concatenation operator for fixed_size_string.
Definition: fixed_size_str.hpp:135
static constexpr auto std_size(T v) noexcept
Converts argument to std size type.
Definition: types.hpp:52

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).