Zero  0.1.0
Classes | Macros | Functions
guard.h File Reference
#include <cstdio>
#include <cassert>
#include <cstddef>
#include <unistd.h>
#include "trace.h"
#include <type_traits>

Go to the source code of this file.

Classes

class  guard< T >
 A generic RAII guard class. More...
 
class  guard_base_t< T, Impl >
 A generic pointer guard base class. An action will be performed exactly once on the stored pointer, either with an explicit call to done() or when the guard goes out of scope, whichever comes first. More...
 
struct  pointer_guard_base_t< T, Impl >
 
struct  pointer_guard_t< T >
 Ensures that a pointer allocated with a call to operator new() gets deleted. More...
 
struct  array_guard_t< T >
 Ensures that an array allocated with a call to operator new() gets deleted. More...
 
struct  file_guard_t
 Ensures that a file gets closed. More...
 
struct  fd_guard_t
 Ensures that a file descriptor gets closed. More...
 

Macros

#define alignmentof(type)   (std::alignment_of<type>())
 

Functions

void test_alignment (void const *ptr, int align)
 
template<class T >
Taligned_cast (void const *ptr)
 

Macro Definition Documentation

§ alignmentof

#define alignmentof (   type)    (std::alignment_of<type>())

Function Documentation

§ aligned_cast()

template<class T >
T* aligned_cast ( void const *  ptr)
inline

§ test_alignment()

void test_alignment ( void const *  ptr,
int  align 
)
inline