I have a typedef inside a class from a c++ machine library (dlib) that looks like this:
typedef dlib::matrix<double, 64, 1> sample_type;
Except the 64 is actually a variable. I’d like the typedef to be visible throughout the class, but I want the second parameter (the 64) be an argument when the constructor is called. How can I achieve this, while keeping the typedef visible everywhere?
As a general case this is not possible. Although you might want to write the following:
Note that inside the template 2 data fields are defined. The first data field will be created with the current instantiation parameter. Second data field will be created using explicit parameter.
As you see, inside the template it seems to be what you want, but outside only constants can be used.