LibraryLink Utilities  3.0.1
Modern C++ wrapper over LibraryLink and WSTP
Utilities.hpp File Reference

Short but generally useful functions. More...

Detailed Description

Short but generally useful functions.

Author
Rafal Chojna rafal.nosp@m.c@wo.nosp@m.lfram.nosp@m..com
Date
8/07/2017
#include <complex>
#include <cstdint>
#include <type_traits>
#include <utility>
#include <variant>
#include "LLU/LibraryData.h"
+ 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.

Classes

struct  LLU::dependent_false< T >
 Get a type that inherits from false_type and ignores the template parameter completely. More...
 
struct  LLU::NumericArrayFromEnum< numericarray_data_t >
 Utility structure that matches an MNumericArray data type with corresponding C++ type. More...
 

Namespaces

 LLU
 Main namespace of LibraryLink Utilities.
 
 LLU::NA
 Small namespace for NumericArray related utilities.
 

Type aliases

template<typename T >
using LLU::remove_cv_ref = std::remove_cv_t< std::remove_reference_t< T > >
 Utility type that strips any given type from reference and cv qualifiers. More...
 
template<typename A , typename B >
using LLU::disable_if_same_or_derived = typename std::enable_if_t<!std::is_same< A, B >::value &&!std::is_base_of< A, remove_cv_ref< B > >::value >
 Utility type that is valid only if B is not A and not a subclass of A. More...
 
template<typename A , typename B >
using LLU::enable_if_same_or_derived = typename std::enable_if_t< std::is_same< A, B >::value||std::is_base_of< A, remove_cv_ref< B > >::value >
 Utility type that is valid only if B is A or a subclass of A. More...
 
template<typename Iterator >
using LLU::enable_if_input_iterator = enable_if_same_or_derived< std::input_iterator_tag, typename std::iterator_traits< Iterator >::iterator_category >
 Utility type that checks if given type can be treated as input iterator. More...
 
template<typename Container >
using LLU::enable_if_integral_elements = typename std::enable_if_t< std::is_integral< typename std::remove_reference_t< Container >::value_type >::value >
 Utility type that checks if given container type has elements that are integers (and therefore can be used as Tensor or NumericArray dimensions) More...
 
template<numericarray_data_t rat>
using LLU::NumericArrayTypeFromEnum = typename NumericArrayFromEnum< rat >::type
 Simple type alias to easily extract type from NumericArrayFromEnum. More...
 

Enumerations

enum  LLU::NA::ConversionMethod {
  Check = MNumericArray_Convert_Check,
  ClipCheck = MNumericArray_Convert_Clip_Check,
  Coerce = MNumericArray_Convert_Coerce,
  ClipCoerce = MNumericArray_Convert_Clip_Coerce,
  Round = MNumericArray_Convert_Round,
  ClipRound = MNumericArray_Convert_Clip_Round,
  Scale = MNumericArray_Convert_Scale,
  ClipScale = MNumericArray_Convert_Clip_Scale
}
 Possible methods of handling out-of-range data when converting a NumericArray to different type. More...
 

Functions

template<typename VariantType , typename T , std::size_t index = 0>
constexpr std::size_t LLU::variant_index ()
 Get index of given type in the variant. More...
 
template<typename... Ts>
void LLU::Unused (Ts &&...)
 Dummy function called on otherwise unused parameters to eliminate compiler warnings. More...
 
std::string LLU::NA::typeToString (numericarray_data_t t)
 Get name of the given MNumericArray type, e.g. More...
 

Variables

template<typename Container >
constexpr bool LLU::has_size_v = has_size<Container>::value
 A type trait to check whether type Container has a member function size() More...
 
template<typename Container , typename T >
constexpr bool LLU::is_iterable_container_with_matching_type_v
 A type trait to check whether type Container is a class type with a member type alias value_type equal to T and with begin() and end() methods. More...
 
template<typename T >
constexpr bool LLU::dependent_false_v = dependent_false<T>::value
 Compile-time boolean constant false that "depends" on a template parameter. More...
 
template<typename T >
constexpr imagedata_t LLU::ImageType = MImage_Type_Undef
 Utility variable template that matches a C++ type with a corresponding MImage data type. More...
 
template<typename T >
constexpr numericarray_data_t LLU::NumericArrayType = MNumericArray_Type_Undef
 Utility structure that matches a C++ type with a corresponding MNumericArray data type. More...
 
template<typename T >
constexpr mint LLU::TensorType = MType_Undef
 Utility structure that matches a C++ type with a corresponding MTensor data type. More...