Overall, your code is clean, well written and seems very consistent (and the comments also seem relevant). There is not much to say, so I will focus on some details since I don't see anything else to review:
First of all, Loki is right in his comment: your header guards names (
UNIFORM_SELECTION_SGL_HPP__
,INTRUSIVE_RANDOM_CHOICE_SGL_HPP__
...) are actually reserved to the implementation reserved to the implementation since they contain double underscores. You should remove the last underscore so that they are well-formed.It is mainly a matter of taste, but I would use the new type alias syntax (with
using
) instead of the oldtypedef
. Contrary totypedef
,using
can be templated, therefore it allows you to always be consistent, whether you have templates or not. Also, I find theX = Y
syntax clearer and closer to variable assignment.A tidbit:
std::is_same<GeneratorType, std::mt19937>::value
I would replace
GeneratorType
bygenerator_type
. It won't change the generated code but since you use thetypedef
s instead of the template parameters names in the rest of your code, it will be more consistent.//This branch will be optimized out at compile time
I would replace
will
byshould
. While any decent compiler should optimize it, there is no such garantee that it will be the case for any compiler. Since you don't know which compiler your code will be compiled with, you shouldn't make the assumption (Ok, that's really a detail).You could use curly braces instead of parenthesis in the initialization list of your constructors to prevent implicit type conversions.
As you can see, there is almost nothing to say about your current code. You even used std::shuffle
and that's great (even greater since std::random_shuffle
will be deprecated in C++14). That's some really good code, kudos! :)
Overall, your code is clean, well written and seems very consistent (and the comments also seem relevant). There is not much to say, so I will focus on some details since I don't see anything else to review:
First of all, Loki is right in his comment: your header guards names (
UNIFORM_SELECTION_SGL_HPP__
,INTRUSIVE_RANDOM_CHOICE_SGL_HPP__
...) are actually reserved to the implementation since they contain double underscores. You should remove the last underscore so that they are well-formed.It is mainly a matter of taste, but I would use the new type alias syntax (with
using
) instead of the oldtypedef
. Contrary totypedef
,using
can be templated, therefore it allows you to always be consistent, whether you have templates or not. Also, I find theX = Y
syntax clearer and closer to variable assignment.A tidbit:
std::is_same<GeneratorType, std::mt19937>::value
I would replace
GeneratorType
bygenerator_type
. It won't change the generated code but since you use thetypedef
s instead of the template parameters names in the rest of your code, it will be more consistent.//This branch will be optimized out at compile time
I would replace
will
byshould
. While any decent compiler should optimize it, there is no such garantee that it will be the case for any compiler. Since you don't know which compiler your code will be compiled with, you shouldn't make the assumption (Ok, that's really a detail).You could use curly braces instead of parenthesis in the initialization list of your constructors to prevent implicit type conversions.
As you can see, there is almost nothing to say about your current code. You even used std::shuffle
and that's great (even greater since std::random_shuffle
will be deprecated in C++14). That's some really good code, kudos! :)
Overall, your code is clean, well written and seems very consistent (and the comments also seem relevant). There is not much to say, so I will focus on some details since I don't see anything else to review:
First of all, Loki is right in his comment: your header guards names (
UNIFORM_SELECTION_SGL_HPP__
,INTRUSIVE_RANDOM_CHOICE_SGL_HPP__
...) are actually reserved to the implementation since they contain double underscores. You should remove the last underscore so that they are well-formed.It is mainly a matter of taste, but I would use the new type alias syntax (with
using
) instead of the oldtypedef
. Contrary totypedef
,using
can be templated, therefore it allows you to always be consistent, whether you have templates or not. Also, I find theX = Y
syntax clearer and closer to variable assignment.A tidbit:
std::is_same<GeneratorType, std::mt19937>::value
I would replace
GeneratorType
bygenerator_type
. It won't change the generated code but since you use thetypedef
s instead of the template parameters names in the rest of your code, it will be more consistent.//This branch will be optimized out at compile time
I would replace
will
byshould
. While any decent compiler should optimize it, there is no such garantee that it will be the case for any compiler. Since you don't know which compiler your code will be compiled with, you shouldn't make the assumption (Ok, that's really a detail).You could use curly braces instead of parenthesis in the initialization list of your constructors to prevent implicit type conversions.
As you can see, there is almost nothing to say about your current code. You even used std::shuffle
and that's great (even greater since std::random_shuffle
will be deprecated in C++14). That's some really good code, kudos! :)
Overall, your code is clean, well written and seems very consistent (and the comments also seem relevant). There is not much to say, so I will focus on some details since I don't see anything else to review:
First of all, Loki is right in his comment: your header guards names (
UNIFORM_SELECTION_SGL_HPP__
,INTRUSIVE_RANDOM_CHOICE_SGL_HPP__
...) are actually reserved to the implementation since they contain double underscores. You should remove the last underscore so that they are well-formed.It is mainly a matter of taste, but I would use the new type alias syntax (with
using
) instead of the oldtypedef
. Contrary totypedef
,using
can be templated, therefore it allows you to always be consistent, whether you have templates or not. Also, I find theX = Y
syntax clearer and closer to variable assignment.A tidbit:
std::is_same<GeneratorType, std::mt19937>::value
I would replace
GeneratorType
bygenerator_type
. It won't change the generated code but since you use thetypedef
s instead of the template parameters names in the rest of your code, it will be more consistent.//This branch will be optimized out at compile time
I would replace
will
byshould
. While any decent compiler should optimize it, there is no such garantee that it will be the case for any compiler. Since you don't know which compiler your code will be compiled with, you shouldn't make the assumption (Ok, that's really a detail).You could use curly braces instead of parenthesis in the initialization list of your constructors to prevent implicit type conversions.
As you can see, there is almost nothing to say about your current code. You even used std::shuffle
and that's great (even greater since std::random_shuffle
will be deprecated in C++14). That's some really good code, kudos! :)