lundi 3 juillet 2017

Unable to use curly brackets to assign values to c++ pair

Whenever I use curly brackets to assign values to a pair I get the following error

error: expected expression
    p = {0, 0};

Here's the code -

#include <iostream>
using namespace std;

int main() {
    pair<int, int> p;
    p = {0, 0};
    return 0;
}

I am using a clang compiler that comes with Xcode.

I have no idea why this isn't working as it works fine on ideone

Aucun commentaire:

Enregistrer un commentaire