xapian-core  2.0.0
Functions
alignment_cast.h File Reference

Cast a pointer we know is suitably aligned. More...

#include <type_traits>
+ Include dependency graph for alignment_cast.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T , typename U >
std::enable_if_t< std::is_const_v< typename std::remove_pointer_t< U > >, T > alignment_cast (U ptr)
 Cast a pointer we know is suitably aligned. More...
 
template<typename T , typename U >
std::enable_if_t<!std::is_const_v< typename std::remove_pointer_t< U > >, T > alignment_cast (U ptr)
 Cast a pointer we know is suitably aligned. More...
 

Detailed Description

Cast a pointer we know is suitably aligned.

Definition in file alignment_cast.h.

Function Documentation

◆ alignment_cast() [1/2]

template<typename T , typename U >
std::enable_if_t<std::is_const_v<typename std::remove_pointer_t<U> >, T> alignment_cast ( ptr)

Cast a pointer we know is suitably aligned.

Has the same effect as reinterpret_cast<T> but avoids warnings about alignment issues.

Version for const pointers.

Definition at line 39 of file alignment_cast.h.

◆ alignment_cast() [2/2]

template<typename T , typename U >
std::enable_if_t<!std::is_const_v<typename std::remove_pointer_t<U> >, T> alignment_cast ( ptr)

Cast a pointer we know is suitably aligned.

Has the same effect as reinterpret_cast<T> but avoids warnings about alignment issues.

Version for non-const pointers.

Definition at line 53 of file alignment_cast.h.