kblib 0.2.3
General utilities library for modern C++
logic.cpp File Reference
#include "catch.hpp"
#include "kblib/logic.h"
#include <array>
#include <iostream>
#include <string>
Include dependency graph for logic.cpp:

Go to the source code of this file.

Classes

struct  tag< Is >
 

Functions

template<int I1, int I2>
auto multi_template () -> int
 
template<std::size_t COL, typename T , std::size_t rows, std::size_t cols, std::size_t... row>
constexpr auto get_col (const std::array< std::array< T, cols >, rows > &in, std::index_sequence< row... >) -> std::array< T, rows >
 
template<typename T , std::size_t rows, std::size_t cols, std::size_t... row, std::size_t... col>
constexpr auto transpose_arr_impl (const std::array< std::array< T, cols >, rows > &in, std::index_sequence< col... >) -> std::array< std::array< T, rows >, cols >
 
template<typename T , std::size_t rows, std::size_t cols>
constexpr auto transpose_arr (std::array< std::array< T, cols >, rows > in) -> std::array< std::array< T, rows >, cols >
 
 TEST_CASE ("transpose")
 
template<int I2, int... Is1>
constexpr auto gen_row (tag< Is1... >) -> std::array< int(*)(), 8 >
 
template<typename Tag1 , int... Is2>
constexpr auto gen_dispatch_table () -> std::array< std::array< int(*)(), 8 >, 8 >
 
auto multi_dispatcher (int i1, int i2) -> int
 
 TEST_CASE ("run-time template dispatching")
 

Variables

constexpr std::array< std::array< int(*)(), 8 >, 8 > dispatch_table
 

Function Documentation

◆ gen_dispatch_table()

template<typename Tag1 , int... Is2>
constexpr auto gen_dispatch_table ( ) -> std::array<std::array<int (*)(), 8>, 8>
constexpr

Definition at line 63 of file logic.cpp.

◆ gen_row()

template<int I2, int... Is1>
constexpr auto gen_row ( tag< Is1... >  ) -> std::array<int (*)(), 8>
constexpr

Definition at line 58 of file logic.cpp.

◆ get_col()

template<std::size_t COL, typename T , std::size_t rows, std::size_t cols, std::size_t... row>
constexpr auto get_col ( const std::array< std::array< T, cols >, rows > &  in,
std::index_sequence< row... >   
) -> std::array<T, rows>
constexpr

Definition at line 19 of file logic.cpp.

◆ multi_dispatcher()

auto multi_dispatcher ( int  i1,
int  i2 
) -> int

Definition at line 72 of file logic.cpp.

◆ multi_template()

template<int I1, int I2>
auto multi_template ( ) -> int

Definition at line 10 of file logic.cpp.

◆ TEST_CASE() [1/2]

TEST_CASE ( "run-time template dispatching"  )

Definition at line 87 of file logic.cpp.

◆ TEST_CASE() [2/2]

TEST_CASE ( "transpose"  )

Definition at line 48 of file logic.cpp.

◆ transpose_arr()

template<typename T , std::size_t rows, std::size_t cols>
constexpr auto transpose_arr ( std::array< std::array< T, cols >, rows >  in) -> std::array<std::array<T, rows>, cols>
constexpr

Definition at line 34 of file logic.cpp.

◆ transpose_arr_impl()

template<typename T , std::size_t rows, std::size_t cols, std::size_t... row, std::size_t... col>
constexpr auto transpose_arr_impl ( const std::array< std::array< T, cols >, rows > &  in,
std::index_sequence< col... >   
) -> std::array<std::array<T, rows>, cols>
constexpr

Definition at line 27 of file logic.cpp.

Variable Documentation

◆ dispatch_table

constexpr std::array<std::array<int (*)(), 8>, 8> dispatch_table
constexpr
Initial value:
= gen_dispatch_table<tag<6, 13, 14, 19, 22, 22, 24, 27>, 1, 3, 5, 6, 18, 21,
25, 31>()

Definition at line 68 of file logic.cpp.