C++Extra (Add-on) (New!) (Please try!)

Pages: 123
closed account (N36fSL3A)
I simply don't like using it... that's all.
@Lumpkin
The std:: has nothing to do with STL, from my understanding. It simply is a way of denoting that the objects are part of the standard namespace that encompasses the C++ standard and the STL (list, queue, stack, vector, etc).
Last edited on by closed account z6A9GNh0
I think he was referring to the variables that are used int he STL algorithms like min , max , count , ect..
Lumpkin has the right idea, verbosity is better. But programmers are lazy and will do anything to avoid excess typing.
Lumpkin wrote:
I never, ever, not even with my own namespaces, use "using". I'm not planning on it either.


Never say never.

There are good reasons for using using declarations.

See http://stackoverflow.com/questions/4782692/what-does-using-stdswap-inside-the-body-of-a-class-method-implementation-mea for one such situation.
Some people also use for situations like this

1
2
3
4
5
6
7
8
9
10
11
struct List
{
    struct Node { int data , Node *next };
    //...
};


int main()
{
    using Node = List::Node;
}


*typo
Last edited on
verbosity is better.

This coming from an advocate of range based for loops :P
Not saying that I don't agree, cause I do.
Last edited on
I don't consider range-based for-loops a loss of verbosity, but that is highly opinion-based. I'm mainly just repeating things I have heard Stroustrup say and recommend, such as verbosity being better.
Last edited on
Fair point, range based for's are no less specific in what they do at least, whereas using using can potentially obfuscate code.
My rule is to only use using in source files (so as not to affect other source files), to never use using namespace std; and to use other using declarations only when necessary.
Last edited on
Topic archived. No new replies allowed.
Pages: 123