1

クラスエッジ:

class Edge {
    int dist = 0;
    std::pair<Node, Node> ends;
public:
    Edge() = default;
    explicit Edge(const int idist) : dist(idist) { }
    explicit Edge(const int idist, Node& end1, Node& end2) : dist(idist) {
        ends.first = end1;
        ends.second = end2;
    }
    ~Edge() = default;
};

ctorexplicit Edge(const int idist, Node& end1, Node& end2)で、構文を使用できないのはなぜですか?:

explicit Edge(const int idist, Node& end1, Node& end2) : dist(idist), ends.first(end1), ends.second(end2) { }
4

3 に答える 3