4
votes
1answer
75 views

std::tuple foreach implementation

I wrote "foreach" implementation for std::tuple. Here it is: ...
2
votes
1answer
48 views

std::tuple objects or rvalue references?

I have some small "plugin system" (not sure this is right name). It allow you to store objects (plugins), and then call some methods from each of them. With this approach we have absolutely no ...
4
votes
1answer
88 views

User defined literal for std::integral_constant

I created a user defined literal _c to convert an "integer" literal into an std::integral_constant. Basically, the goal is to ...
9
votes
2answers
576 views

Compile time decorator pattern in C++ with templates

I'm doing some high energy physics modelling in C++. I have written code that implements class that score interactions of particles with detector material. Here is a base class: ...
6
votes
1answer
78 views

Dynamically call lambda based on stream input: Try 3

Based on Dynamically call lambda based on stream input: Try 2 This fixes most of the points pointed out by @Morwenn. It has been generalized so anybody can call it. The only extra part needed by the ...
7
votes
1answer
111 views

C++ template Range

From a previous question I got an answer that included some template magic (that to be blunt was mind boggling (as I could not understand it)). So I have been trying to achieve the same results ...
11
votes
2answers
211 views

Very basic tuple implementation

I've been messing with metaprogramming and variadic templates in C++, and I came up with this very primitive implementation of a tuple: ...
3
votes
1answer
75 views

Should I use an object or type as trait?

Edit: Disclaimer: I am new to templates and traits. I apologize in advance if this is a bad question. I am refactoring two similar classes with small differences strewn all over them into one ...
4
votes
1answer
1k views

C++ compile-time checked switch 'statement'

In the project I work on there are several places where a switch statement is used on a type enum. (I know, better to use virtual functions or a visitor pattern or something, but sometimes switching ...
2
votes
1answer
257 views

How can I improve the design of this serialization mechanism?

I'm working on caching library which is intended to work with all types of values. Values are represented as instances of value_type: ...