You cannot provide an explicit list of template arguments for the constructor, and the template parameter cannot be inferred from the function argument by default, so the type_position position
function parameter must be explicitly specified (not set by default) to infer the type.
Since this is the last parameter, it does not allow the use of any of the default arguments for contructor. You can reorder the constructor options to specify type_position
first, or you can add a dummy argument that allows it to be output:
template <typename type_position> window( type_position dummy, const int size[2], const char* caption="Window", const SDL_Surface* icon=NULL, bool fullscreen=false, bool vsync=true, bool resizable=false, int multisample=0, type_position position=type_position(0) );
Then call it using the dummy first parameter of the inference type:
new window(1, screen_size,"My Window",NULL,fullscreen);
Alternatively, if you are using C ++ 11, you can specify a default template argument:
template <typename type_position = int> window( const int size[2], const char* caption="Window", const SDL_Surface* icon=NULL, bool fullscreen=false, bool vsync=true, bool resizable=false, int multisample=0, type_position position=type_position(0) );
Alternatively, decide if you really need a template constructor with the parameter you want to output. What do you plan to do with type_position
if you donโt know what is ahead of time? Does someone really call this constructor with std::string
as the position
parameter? Or a vector<double>
? This may make sense, depending on what your type does, but it does not always make sense.