hx3d  1
2D/3D Simple Game Framework
Functions
hx3d::algo Namespace Reference

Useful algorithm helpers. More...

Functions

template<class Container , class Function >
void apply (Container &container, Function func)
 Function application helper on a container. More...
 
template<class Source , class Dest >
void clone (Source &src, Dest &dst)
 Clone a container. More...
 
template<class Container , class Type >
Type reduce (Container &container, Type init)
 Apply a simple reduce. More...
 
template<class Container , class Type , class Operation >
Type reduce (Container &container, Type init, Operation operation)
 Apply a reduce operation. More...
 

Detailed Description

Useful algorithm helpers.

Function Documentation

template<class Container , class Function >
void hx3d::algo::apply ( Container &  container,
Function  func 
)

Function application helper on a container.

Parameters
containerContainer
funcFunction

Example code

// Vector creation from 1 to 6
std::vector<int> v = {1, 2, 3, 4, 5, 6};
// Display each value
algo::apply(v, [](int e) { Log.Info("Num: %d", e); });

Definition at line 25 of file algorithm.inl.hpp.

template<class Source , class Dest >
void hx3d::algo::clone ( Source &  src,
Dest &  dst 
)

Clone a container.

Parameters
srcSource container
dstDestination container

Definition at line 30 of file algorithm.inl.hpp.

template<class Container , class Type >
Type hx3d::algo::reduce ( Container &  container,
Type  init 
)

Apply a simple reduce.

Parameters
containerContainer
initBase value
Returns
Accumulated value

Definition at line 35 of file algorithm.inl.hpp.

template<class Container , class Type , class Operation >
Type hx3d::algo::reduce ( Container &  container,
Type  init,
Operation  operation 
)

Apply a reduce operation.

Parameters
containerContainer
initBase value
operationOperation
Returns
Accumulated value

Definition at line 40 of file algorithm.inl.hpp.