From f9844b741feac35622b9566c6afae9bb686f5149 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 24 Jan 2015 12:07:55 +0100 Subject: Added `MakeList` list generator * as its name implies this function returns a list of `Count` elements of value `Element` * added appropriate test case --- src/list/generator/make_list.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/list/generator/make_list.h (limited to 'src') diff --git a/src/list/generator/make_list.h b/src/list/generator/make_list.h new file mode 100644 index 0000000..3bf65a2 --- /dev/null +++ b/src/list/generator/make_list.h @@ -0,0 +1,30 @@ +#ifndef TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_ +#define TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_ + +#include "list/cons.h" +#include "operation/math.h" + +namespace tav { + +template < + typename Count, + typename Element +> +struct MakeList { + typedef Cons< + Element, + typename MakeList< + Substract>, + Element + >::type + > type; +}; + +template +struct MakeList, Element> { + typedef Cons type; +}; + +} + +#endif // TYPEASVALUE_SRC_LIST_GENERATOR_MAKE_LIST_H_ -- cgit v1.2.3