Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9091769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:41:26+00:00 2026-06-16T22:41:26+00:00

When we look at STL header files, we see many macros used where we

  • 0

When we look at STL header files, we see many macros used where we could instead write single lines, or sometimes single word, directly. I don’t understand why people use so many macros. e.g.

 _STD_BEGIN

using ::type_info;

 _STD_END


 #if defined(__cplusplus)
  #define _STD_BEGIN    namespace std {
  #define _STD_END      }
  #define _STD  ::std::
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:41:27+00:00Added an answer on June 16, 2026 at 10:41 pm

    Library providers have to cope with a wide range of implementations and use case. I can see two reasons for use of macros in this case (and there are probably others I’m not thinking about now):

    • the need to support compilers which don’t support namespace. I’m not sure if it would be a concern for a recent implementation, but most of them have a long history and removing such macros even if compilers which don’t support namespaces are no more supported (the not protected using ::type_info; hints that it is the case) would have a low priority.

    • the desire to allow customers to use their implementation of the standard library in addition to the one provided by the compiler provider without replacing it. Configuring of the library would then allow to substitute another name for std.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can a STL map be used for keys of varying sizes? I don't have
The C++ STL class std::map implements O(log(n)) look-up using a binary tree. But with
Working on an algorithm to look at a STL container of STL strings (or
I was having a nice look at my STL options today. Then I thought
I was supposed to write C implementation of C++ STL container map (associative array)
Look at the function below. I want to pass a vector of factors and
look here: http://jsfiddle.net/QTrat/10/ I want to stretch the red box to the floated children
Look the code below. I'd like to replace USERNAME by the field name received
look at this fiddle: http://jsfiddle.net/ugxNK/ I want that the first list element is in
Look at the code: template <class x> struct Foo { int getX(x *p) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.