Your PTHREAD_MUTEX_INITIALIZER
is somewhat equivalent to a list of initializers.
In C ++ 03, you can initialize an array as follows:
int arr[5] = {1,2,3,4,5};
Pay attention to the list of initializers. However, there is no support for classes.
In C ++ 11, they added std::initializer_list<T>
, so this syntax is possible. Consider the following:
std::vector<int> v = {1,2,3,4,5};
Or, even easier:
std::vector<int> v{1,2,3,4,5};
This will work in C ++ 11, but not in C ++ 03, because in C ++ 11 a vector has a constructor that takes an argument from an initializer list. You can include this in your own classes. Note that the latter is equivalent to the following, as usual:
std::vector<int> v ({1,2,3,4,5});
This helps illustrate that the list of initializers is now actual.
If you want to see the Stroustrup publication, I point you to the C ++ 11 FAQ .