Ask Your Question

Revision history [back]

std points at the standard c++ namespace on your system containing all basic functionality for c++ functions. if you write it then you are allowed to just use function names and basic c++ types directly.

For example: int c = builtinFunction1(parameter2);

However if you would not use it, you would have to define the same command as

std::int c = std::builtinFunction1(parameter2);

Reason for the existance of namespaces is very simple. C++ does not deny you to redefine existing types or redefine existing functionality. This means that if I would define a namespace TEST, then I could add built-in C++ commands that act totally different as I define it.

The following command would do complete different things if I wanted it to and could be used to divert between my int type and the standard int type.

std::int c = std::builtinFunction1(parameter2); TEST::int c = TEST::builtinFunction1(parameter2);

It would be actually two complete different variables of another type. This is why most OpenCV programs also have the following command: using

namespace cv;

This in turn allows you to use commands like

Mat test = new Mat();

If the command would not have been placed, then the compiler would not recognize the type and would ask you to actually write the following to have working code:

cv::Mat test = new cv::Mat();

Hope this makes sense!