मैं समझता हूँ कि कैसे back_inserter
काम कोशिश कर रहा हूँ, और यह इसके कार्यान्वयन है कि मैं एसजीआई-एसटीएल से है:back_inserter कैसे काम करता है?
template<class C>
class back_insert_iterator {
protected:
C* container;
public:
typedef C container_type;
typedef output_iterator_tag iterator_category;
typedef void value_type;
typedef void difference_type;
typedef void pointer;
typedef void reference;
explicit back_insert_iterator(C& __x) :container(&__x) {
}
back_insert_iterator<C>& operator=(const typename C::value_type& val) {
container->push_back(val);
return *this;
}
back_insert_iterator<C>& operator*() {
return *this;
}
back_insert_iterator<C>& operator++() {
return *this;
}
back_insert_iterator<C>& operator++(int) {
return *this;
}
};
मैं समझ अधिकांश हिस्सों को छोड़कर पिछले तीन ऑपरेटर *, ++ ++ (int)। उनके अस्तित्व के लिए मेरा अनुमान यह है कि एसटीएल एल्गोरिदम के अंदर रखे जाने पर उन्हें संचालन का समर्थन करने की आवश्यकता होती है। इसके अलावा, मुझे नहीं पता कि वे किस लिए उपयोग किए जाते हैं? क्या कोई मुझे इसे स्पष्ट करने में मदद कर सकता है?
धन्यवाद,
चैन
बहुत धन्यवाद;)। आपकी प्रतिक्रिया आश्चर्यजनक रूप से त्वरित थी ^^ – Chan