내가 가지고 있다고 가정 해 봅시다 :const std :: pair를 어떻게 초기화합니까?
#include <utility>
using namespace std;
typedef pair<int, int> my_pair;
어떻게 const my_pair를 초기화합니까?
내가 가지고 있다고 가정 해 봅시다 :const std :: pair를 어떻게 초기화합니까?
#include <utility>
using namespace std;
typedef pair<int, int> my_pair;
어떻게 const my_pair를 초기화합니까?
생성자 사용
const my_pair p(1, 2);
CONST의 my_pair의 my_pair p = (3, 2); C++ 11
const my_pair p = std::make_pair(2, 3);
당신은 또한 다음 중 하나를 사용할 수 있습니다
const my_pair p = {2, 3};
const my_pair p({2, 3});
const my_pair p{2, 3};
을