c++ - VS2013: Can't create vector from one size_t element -


just want make sure bug , i'm not doing wrong. compiles fine gcc (mingw):

std::vector<size_t> a({1, 2}); // works std::vector<size_t> b({1}); // not work std::vector<int> c({1}); // works 

error:

error c2440: 'initializing' : cannot convert 'initializer-list' 'std::vector<std::seed_seq::result_type,std::allocator<char32_t>>' 

it bug in vs2013 believe initializer-lists added in version. note if omit () seems work fine:

std::vector<size_t> b{ 1 }; // works 

trying few other variations yields surprising results too:

std::vector<size_t> b({ 1 });            // not work std::vector<size_t> b1({ 1u });          // not work std::vector<long> b2({ 1 });             // not work std::vector<long> b3({ 1l });            // works std::vector<long long> b4({ 1l });       // not work std::vector<unsigned int> b5({ 1u });    // not work std::vector<size_t> b6{ 1 };             // works std::vector<unsigned char> b7({ 1 });    // not work std::vector<unsigned char> b8({ 1u });   // works std::vector<unsigned short> b9({ 1 });   // not work std::vector<unsigned short> b10({ 1u }); // works std::vector<unsigned int> b11({ 1u });   // not work std::vector<int> b12({ 1u });            // works std::vector<int> b13({ 1l });            // works 

removing () above cases don't compile makes work.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -