devxlogo

Namespace std May Not Be Modified

Namespace std May Not Be Modified

Generally, namespaces are open so it is perfectly legal to expand existing namespaces with additional declarations and definitions in several files. The only exception to the rule is namespace std. According to the C++ Standard, the result of modifying namespace std with additional declarations–let alone a removal of existing ones–is undefined and should be avoided. This restriction may seem arbitrary but it’s just common sense; any attempt to tamper with namespace std undermines the very concept of a namespace dedicated exclusively to standard declarations.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist