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

  • Home
  • SEARCH
  • 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 7027815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:17:54+00:00 2026-05-28T00:17:54+00:00

Can I achieve the same effects without the C++ header <initializer_list> ? Does class

  • 0

Can I achieve the same effects without the C++ header <initializer_list>?

Does class initializer_list have to live in namespace std (does the compiler require this)?

I’m fine with a solution that works on the big five (GCC, MSVC, Intel, Clang, Comeau)

  • 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-05-28T00:17:55+00:00Added an answer on May 28, 2026 at 12:17 am

    It’s tightly coupled as per standard. It’s a wrapper around a compiler-constructed array (though the standard doesn’t say how precisely — GCC uses constructor with pointer and size, MSVC uses constructor with two points). And yes, it’s required to be in namespace std, and in header <initializer_list>.

    You’d have to see what constructors they use in each compiler you want to support and replicate that in your version, but TBH, I fail to see the point.

    The template std::initializer_list is not predefined; if the header <initializer_list> is not included prior to a use of std::initializer_list — even an implicit use in which the type is not named (7.1.6.4) — the program is ill-formed.

    An object of type std::initializer_list<E> is constructed from an initializer list as if the implementation allocated an array of N elements of type E, where N is the number of elements in the initializer list.
    Each element of that array is copy-initialized with the corresponding element of the initializer list, and the std::initializer_list<E> object is constructed to refer to that array.

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

Sidebar

Related Questions

how can i paste something on multiple lines? i'm trying to achieve the same
Does anyone know how I can achieve the following effect in OpenGL: Change the
How can I achieve the following? I have two models (blogs and readers) and
In XNA, how can I achieve the same effect of applying a System.Drawing.Imaging.ColorMatrix? The
In Javascript, you can have lonely code blocks, that is, code blocks without an
This is driving me insane. how can i achieve the same effect like the
How can I achieve the same effect as jQuery Masonry, but horizontally? I.e., I'd
If it wasn't a virtual method, you can still achieve the same effect by
Why do we need the html5 canvas element, when the same can be achieved
An old Direct3D book says ...you can achieve an acceptable frame rate with hardware

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.