Page MenuHomeFeedback Tracker

Templates for Functions
Closed, ResolvedPublic

Description

So far templates can only be used to classes:

class MyClass<Class T> {}

But to use templates to its full extend, it is necessary to have functions using their own templates. For example, to pass an instance of this class to a function as a parameter, this function must be overloaded for all possible classes individually.

void function(MyClass<int> m) {}
void function(MyClass<float> m) {}
...

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General
Additional Information

Suggested syntax:

void function<Class T>(MyClass<T> m) {}

Event Timeline

CallMeMax edited Additional Information. (Show Details)
Geez changed the task status from New to Assigned.Jun 27 2022, 7:56 PM
Geez closed this task as Resolved.Apr 20 2023, 4:04 PM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello CallMeMax.
We have just simple implementation of templates. no plans for extending it for now.