473,378 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Why there is just one namespace 'std' in the std library?

bb
Hi,

Is there any specific reason(s) that there is only one namespace
'std' in the standard library?

e.g. namespaces are not really independent, name collisions etc.

Should one consider not introducing too many namespaces while
designing a new system ground up?

Thanks in advance.

Sep 7 '07 #1
1 1218
* bb:
>
Is there any specific reason(s) that there is only one namespace
'std' in the standard library?
There is only one top-level namespace 'std', but there is at least one
nested namespaces, namely 'std::rel_ops'.

And I think that's the only one.

I don't find it remarkable that there's only one top-level namespace
'std', but I think the single nested namespace 'std::rel_ops' /is/
remarkable. Why is it there? And the answer is simple: because many
programmers tend to write 'using namespace std;', but would not like to
then have the standard library's operators imposed on them, i.e. that in
this special case the namespaces is /needed/.

e.g. namespaces are not really independent, name collisions etc.
?

Should one consider not introducing too many namespaces while
designing a new system ground up?
Of course: it is a relevant consideration.
Cheers, & hth.,

- Alf
Sep 7 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: cppaddict | last post by:
It is typical to put the line: using namespace std; at the top of a file which makes use of std library objects. To take a simple example: #include <iostream> using namespace std;
7
by: zbyszek | last post by:
I am working with a large C++ program which, for reasons of backward compatibility, uses C's printf and fprintf rather than iostreams. For a certain type of build I want to provide new functions...
9
by: Randy Yates | last post by:
I've seen this creep into c++ and have never heard of it. It apparently has something to do with the standard C++ library header files (e.g., <string>, <fstream>, etc.). Any illunination? -- % ...
10
by: Christian Christmann | last post by:
Hi, are there any drawbacks using "using namespace std" instead of defining the required namespaces like using std::cout
12
by: bgeneto | last post by:
I know that it's a very basic question, but I can't figure out or find an answer to why do we have to specify a namespace, like this #include<string> using namespace std; when using the...
30
by: Pep | last post by:
Is it best to include the code "using namespace std;" in the source or should each keyword in the std namespace be qualified by the namespace tag, such as std::cout << "using std namespace" <<...
2
by: earthwormgaz | last post by:
I am trying to add the headers for a library I am using to a namespace to avert issues with name clashes. namespace Lib { #include <Lib/SomeFile.h> }; I am finding though that statements to...
11
by: Chris Thomasson | last post by:
I was thinking of how I was going to create a robust versioning system in Standard C++ for my library and was wondering exactly what the point of a namespace alias is? The seem like a rather...
6
by: Juha Nieminen | last post by:
Whenever one sees example C++ code basically anywhere, be it in a book, in a tutorial in the internet, in an online forum or whatever, I would estimate that at least in 99% of cases one sees the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.