Şablon sınıfı için kopya oluşturucu nasıl yazılır. Böylece şablon parametresi başka bir kullanıcı tanımlı sınıfsa, kopya kurucusu da çağrılır. TakipŞablon sınıfı kopya oluşturucu nasıl yazılır
benim sınıf
template <typename _TyV>
class Vertex {
public:
Vertex(_TyV in) : m_Label(in){ }
~Vertex() { }
bool operator < (const Vertex & right) const {
return m_Label < right.m_Label;
}
bool operator == (const Vertex & right) const {
return m_Label == right.m_Label;
}
friend std::ostream& operator << (std::ostream& os, const Vertex& vertex) {
return os << vertex.m_Label;
}
_TyV getLabel() { return m_Label;}
private:
_TyV m_Label;
public:
VertexColor m_Color;
protected:
};
Herhangi bir argüman olarak 'class' kabul edebilecek kopya kurucusuna sahip olmak ister misiniz? – iammilind
@iammilind: Bu bir kopya kurucusu olamaz. –