std::pair

std::pair


std::tupleを2要素でも使ったほうが統一性の面では良いかと思いきや、pairからtupleは構築できるものの、tupleからpairはexplicitにも構築できないのだなー というきもちになっている……。

c++
Copied!
#include <tuple>

int main() {
std::tuple<int, int> a{0, 0}, y;
std::pair<int, int> b, x{0, 0};

// b = std::pair<int, int>{a}; // compile error
y = std::tuple<int, int>{x};
}
Powered by Helpfeel