I yesterday read about Expression Parameters in C++ :
http://www.learncpp.com/cpp-tutorial/144-expression-parameters-and-template-specialization/
I know why you use templates, but why use Expression Parameters when you can just use the constructor to accomplish the same thing?
Oh, and one more thing, are templates handled by the precompiler?
Thank You in Advance.
When you use a template class it will be expanded at compile time and then compiled like a normal class. One reason to use an expression parameter instead of a parameter in a constructor is that the expression becomes part of the type. So all objects of that type will be guaranteed to use the same value.
In the example you linked to:
cIntBuffer is an instance of the class Buffer. It is guaranteed to have a int buffer of size 12. If you had:
cIntBuffer1 and cIntBuffer2 are the same type of object, but they have different buffer sizes.