LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Go to the source code of this file.
Macros | |
#define | dimensionof(x) sizeof(static_array_size_fn(x).c) |
#define | ARRAYEND(x) (x + dimensionof(x)) |
#define | ARRAYBEGIN(x) x |
Functions | |
template<typename T , int N> | |
array_size_struct< N > | static_array_size_fn (T(&)[N]) |
This file provides a set of types, macros, and functions to derive the length of an array whose name is in scope. Templates are so cool. :-)
Most of the code is from "Imperfect C++" by Matthew Wilson
Kevin Lynch 2009
Copied to artg4tk Brendan Kiburg 2013
Definition in file array_macros.hh.
Returns the "begin iterator" (pointer) given by the in-scope array name x.
Definition at line 50 of file array_macros.hh.
#define ARRAYEND | ( | x | ) | (x + dimensionof(x)) |
Returns the "end iterator" (pointer) given an in-scope array name x.
Definition at line 42 of file array_macros.hh.
#define dimensionof | ( | x | ) | sizeof(static_array_size_fn(x).c) |
This macro should only be applied when x is the name of an array which is in scope, or all hell will break loose, with many pages of template instantiation errors pouring forth from the compiler.
Definition at line 37 of file array_macros.hh.
array_size_struct<N> static_array_size_fn | ( | T(&) | [N] | ) |
This function declaration has no associated implementation; it exists solely for compile time argument type deduction. Don't even think about using it.