What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

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 {
public:
  // This is a constructor that accepts an
  // initializer_list, which is a language-magic type supporting
  // iteration over a homogeneous initializer list 
  List(initializer_list<int);
};

// { 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
    
For example question: stackoverflow.com/questions/4757614/… List for the tag shows usage of both things: stackoverflow.com/questions/tagged/initializer-list –  Johannes Schaub - litb Jan 21 '11 at 10:38

2 Answers 2

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

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
3  
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

You must log in to answer this question.

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