Should i use {} over =?

Somebody have asked this question before: http://stackoverflow.com/questions/18222926/why-is-list-initialization-using-curly-braces-better-than-the-alternatives

Correct me if i'm wrong, i should use {} over anything else?
For example:
1
2
3
4
5
6
7
8
9
10
// {}
#include <iostream>

int main(){
    for (int a{1}; a <= 10; ++a){
        std::cout << a << " ";
    }
    
    std::cout << std::endl;
}


1
2
3
4
5
6
7
8
9
10
// =
#include <iostream>

int main(){
    for (int a = 1; a <= 10; ++a){
        std::cout << a << " ";
    }
    
    std::cout << std::endl;
}


1
2
3
4
5
6
7
8
9
10
// ()
#include <iostream>

int main(){
    for (int a(1); a <= 10; ++a){
        std::cout << a << " ";
    }
    
    std::cout << std::endl;
}


1
2
3
4
5
6
7
8
9
10
11
// = {}
#include <iostream>

int main(){
    for (int a = {1}; a <= 10; ++a){
        std::cout << a << " ";
    }
    
    std::cout << std::endl;
}


Should i stick with {}?
Thank you for taking your time to answer. :)

PS: I'm sorry for my bad English, English is not my first language, not second but third. ._.
Four ways to initialization.
1
2
3
4
X t1 = v; // copy initialization possibly copy construction
X t2(v); // direct initialization
X t3 = { v }; //initialize using initializer list 
X t4 = X(v); // make an X from v and copy it to t4 


I would say that each above example has it's own purpose.
Say you need to make sure a copy constructor is called?
Or say you want to avoid using a copy constructor all together?
What if you want to assign more than one value to an array?
What if you want to initialize a value generated during run-time but need to compute data first?

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1919.pdf
Topic archived. No new replies allowed.