Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Containers.h File Reference

Functional-style constexpr container algorithms. More...

#include "Molassembler/Temple/Preprocessor.h"
#include <array>
#include <limits>
#include <functional>
Include dependency graph for Containers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Scine::Molassembler
 Central library namespace.
 
 Scine::Molassembler::Temple
 Template shorthands, optimizers and constexpr data types.
 
 Scine::Molassembler::Temple::Traits
 Compile-time reflective trait objects.
 

Typedefs

template<class Function , typename... Args>
using Scine::Molassembler::Temple::Traits::functionReturnType = std::result_of_t< Function(Args...)>
 Figure out the return type of calling a function.
 
template<class ContainerType >
using Scine::Molassembler::Temple::getValueType = typename Detail::getValueTypeImpl< ContainerType >::type
 Figures out the value type of a container via its iterators.
 

Functions

template<template< typename, std::size_t > class ArrayType, typename T , std::size_t size, class UnaryFunction >
constexpr auto Scine::Molassembler::Temple::map (const ArrayType< T, size > &array, UnaryFunction &&function)
 Maps all elements of any array-like container with a unary function. More...
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t size, class BinaryFunction >
constexpr T Scine::Molassembler::Temple::reduce (const ArrayType< T, size > &array, T init, BinaryFunction &&reduction)
 Reduce an array-like container with a binary function. More...
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t size>
constexpr T Scine::Molassembler::Temple::sum (const ArrayType< T, size > &array)
 Sum up all elements of an array-like class. More...
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t size>
PURITY_STRONG constexpr
std::enable_if_t
< std::is_arithmetic< T >
::value, ArrayType< T, size >> 
Scine::Molassembler::Temple::iota ()
 Iota for any array type.
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t begin, std::size_t end>
constexpr ArrayType< T,(end-begin)> Scine::Molassembler::Temple::range ()
 Range for any array type.
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t N1, std::size_t N2>
constexpr ArrayType< T, N1+N2 > Scine::Molassembler::Temple::arrayConcatenate (const ArrayType< T, N1 > &a, const ArrayType< T, N2 > &b)
 Concatenation of two instances of an array-like class.
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t N, std::size_t... Ns>
constexpr auto Scine::Molassembler::Temple::arrayConcatenate (const ArrayType< T, N > &startingArray, const ArrayType< T, Ns > &...remainingArrays)
 Variadic concatenation of multiple array-like class instances.
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t size>
constexpr bool Scine::Molassembler::Temple::arraysEqual (const ArrayType< T, size > &a, const ArrayType< T, size > &b)
 Array-like container lexicographic equality comparaotr. More...
 
template<template< typename, std::size_t > class ArrayType, typename T , std::size_t sizeA, std::size_t sizeB>
constexpr std::enable_if_t
< (sizeA > sizeB), bool > 
Scine::Molassembler::Temple::arraysLess (const ArrayType< T, sizeA > &a, const ArrayType< T, sizeB > &b)
 Lexicographical comparison for two instances of an array-like class. More...
 
template<typename T , class LessThanPredicate , class Iter >
constexpr Iter Scine::Molassembler::Temple::lowerBound (Iter bound, Iter last, const T &item, LessThanPredicate predicate)
 Constexpr lower bound algorithm from STL. More...
 
template<class Container , typename T , class LessThanPredicate = std::less<>>
constexpr Container::const_iterator Scine::Molassembler::Temple::binarySearch (const Container &container, const T &item, LessThanPredicate predicate=LessThanPredicate())
 Binary search an order container. More...
 
template<class ContainerType , class LessThanComparator = std::less< getValueType<ContainerType> >>
constexpr bool Scine::Molassembler::Temple::isPartiallyOrdered (const ContainerType &container, LessThanComparator comparator=LessThanComparator{})
 Checks if a container is partially ordered. More...
 
template<class ContainerType , class LessThanComparator = std::less< getValueType<ContainerType> >>
constexpr bool Scine::Molassembler::Temple::isTotallyOrdered (const ContainerType &container, LessThanComparator comparator=LessThanComparator{})
 Checks if the container hold strictly increasing values. More...
 

Detailed Description

Functional-style constexpr container algorithms.