Skip to main content
GameDev.net gamedev.net
🔒 Locked

std::

Started by krakrazor Jan 21, 2004 at 5:21 PM 1 replies 250+ views
Original Post
krakrazor
krakrazor
What exactly is std::? and what is it used for?
Rick Scott
Rick Scott
Its a namespace, followed by the scope resolutoin operator.

Namespaces are kinda like classes that can''t be made into actual objects (that is, you can''t say std Variable = 0) and all functions and variables inside it have to be static, so you can''t use -> or . to access the variables and functions.

Oh, and you can add to a namespace by declaring it again.
Promit
Promit
A namespace is like a sort of place where all the variable names, class names, etc. are kept. The usual namespace (i.e. when not using a namespace) is called the global namespace.

STL components use a namespace called std. When you''re coding, the compiler will not look for things in other namespaces, by default (this is to avoid multiple things with the same name). By writing std::bla, you indicate that bla is part of the std namespace, not the global namespace.

You can also use ''using namespace std;'' to tell the compiler that if it can''t find something, it should try looking in the namespace std.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.