h5cpp  0.6.0
A modern C++ wrapper for the HDF5 C library
utilities.hpp File Reference
#include <limits>
#include <type_traits>
#include <utility>
#include <stdexcept>
Include dependency graph for utilities.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename TType , typename SType >
TType unsigned2signed (SType &&source_value)
 convert unsigned to signed integers More...
 
template<typename TType , typename SType >
TType signed2unsigned (SType &&source_value)
 

Function Documentation

◆ signed2unsigned()

template<typename TType , typename SType >
TType signed2unsigned ( SType &&  source_value)

◆ unsigned2signed()

template<typename TType , typename SType >
TType unsigned2signed ( SType &&  source_value)

This operation shows up quite often in the library and causes warnings for virtually all compilers. This template function tries to provide a clean implementation of such a conversion and throws an error if it would fail.

Compile time errors are produced if the types are

Template Parameters
TTypethe unsigned source type
STypesigned target type
Parameters
source_valueuniversal reference to the unsigned source value
Returns
new instance of TType
Exceptions
std::range_errorif the source value does not fit into the positive range of the target signed integer