Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

There is some unfortunate mechanism that merges tags initializer-list and initializer_list. In the new upcoming C++ Standard, these have quite different meanings and usage patterns, and are about different problem domains

class IntList {
  // This is a constructor that accepts an
  // initializer_list, which is a language-magic type supporting
  // iteration over a homogeneous initializer list 

// { 1, 2, 3 } is an initializer list.
int a[] = { 1, 2, 3 };

// {{"foo", 42}, {"bar", 43}} is an initializer list.
map<string, int> m = {{"foo", 42}, {"bar", 43}};

I'm not sure whether it's worth-while to introduce a special case for this, but it seems harmful to merge these two things, since the majority of uses of these two words will refer to the "initializer-list" case, but I still see significant cases of "initializer_list" (which is also the header file where the initializer_list class is defined in).

To be pedantic, there are three things, but I suspect "initializer-list" will, as the "-" is commonly used to serve as a space for tags, be used to mean "initializer list"

  • initializer list refers to the whole brace-enclosed thing - that is { 1, 2, 3 }.
  • initializer-list refers to the grammar that parses the content of the brace enclosed thing - that is, 1, 2, 3.
  • initializer_list refers to the type that a constructor or function can use to iterate over a homogeneous initializer list - that is std::initializer_list<>.
share|improve this question

closed as off-topic by Nathan Tuggy, rene, PythonMaster, Al E., Werner Mar 12 at 4:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question pertains only to a specific site in the Stack Exchange Network. Questions on Meta Stack Exchange should pertain to our network or software that drives it as a whole, within the guidelines defined in the help center. You should ask this question on the meta site where your concern originated." – Nathan Tuggy, rene, PythonMaster, Al E., Werner
If this question can be reworded to fit the rules in the help center, please edit the question.

For example question:… List for the tag shows usage of both things: – Johannes Schaub - litb Jan 21 '11 at 10:38
up vote 6 down vote accepted

I would personally use stdinitializer-list for the case of std::initializer_list<> (like we use stdvector for std::vector<>) and initializer-list for the language construct.

I changed my question to use that scheme.

share|improve this answer
c++ stdvector ×57, c++ vector ×866 – badp Jan 21 '11 at 15:27
I would appreciate help on the wiki: – Johannes Schaub - litb Mar 11 at 18:51

The problem with "correct" tagging is that tagging isn't and can't be perfect. Usage dictates tags, not the other way round; synonyms can nudge usage towards correctness but only by so much. That's why people can retag.

Since there can't be spaces in tags, the standard is to use dashes instead, hence there's no hope of separating initializer-list and initializer list; tag the latter instead :)

As for the other tag, [tag:initializer_list], there's actually no synonym rule in place. All underscores are turned into dashes automatically. So, there's also no hope of separating initializer-list from initializer_list.

I'm no C++ master, but I think this is akin to splitting hairs. They're all the same thing seen from three different points: grammar, type and... er... grammar again. If distinguishing is this important, use a second tag :)

share|improve this answer
I've an idea. I think i will use std::initializer_list for the other case! They are not really the same. It's like the difference between {1, 2, 3} and std::vector<int>. An std::initializer_list<int> is actually much more like a std::vector<int>. An initializer list is just a language construct. – Johannes Schaub - litb Jan 21 '11 at 12:04
Of course this is splitting hair. We're the C++ crowd, so what did you expect? – sbi Jan 21 '11 at 13:55
@johannes Nice try, but will people use the stdinitializer-list tag? :) – badp Jan 21 '11 at 15:26
@badp you can help make it happen: – Johannes Schaub - litb Mar 11 at 18:51
@JohannesSchaub-litb I don't actually know any C++ :) – badp Mar 11 at 22:38

Not the answer you're looking for? Browse other questions tagged .