handling data types as inputs

I 'm fairly new to C++ programming. I wanted to accept a datatype as an input. I've seen something similar while working with the <queue> library.

when defining a new object of queue
for example:
queue<int> Queue;
how is <int> handled ??
std::queue<typename> is a template. It tells the compiler how to build the object at compile time instead of hard coding a class which handles only one datatype.

In this example, you are creating a queue of integers. If you did this:

std::queue<float> Queue;

you would create a queue of floats.
Topic archived. No new replies allowed.