成都創(chuàng)新互聯(lián)是一家專(zhuān)注于成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站與策劃設(shè)計(jì),官渡網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:官渡等地區(qū)。官渡做網(wǎng)站價(jià)格咨詢:13518219792
#pragma once struct InputIteratorTag {}; struct OutputIteratorTag {}; struct ForwardIteratorTag : public InputIteratorTag {}; struct BidirectionalIteratorTag : public ForwardIteratorTag {}; struct RandomAccessIteratorTag : public BidirectionalIteratorTag {}; templatestruct InputIterator { //typedef T ValueType; //typedef Distance DifferenceType; //typedef T* Pointer; //typedef T& Reference; typedef InputIteratorTag IteratorCategory; //迭代器的類(lèi)型 ( 包括上面那5個(gè)struct ) }; template struct IteratorTraits { //typedef typename Iterator::ValueType ValueType; //typedef typename Iterator::DifferenceType DifferenceType; //typedef typename Iterator::Pointer Pointer; //typedef typename Iterator::Reference Reference; typedef typename InputIterator ::IteratorCategory IteratorCategory; }; template struct IteratorTraits //內(nèi)置類(lèi)型的特化版本 { typedef RandomAccessIteratorTag IteratorCategory; }; template inline size_t Distance(InputIterator first, InputIterator last) { return _Distance(first, last, IteratorTraits ::IteratorCategory() ); //這里第三個(gè)參數(shù) 并沒(méi)有實(shí)際意義,不過(guò)正是它的存在,讓_Distance實(shí)現(xiàn)重載 } template inline size_t _Distance(InputIterator first, InputIterator last, RandomAccessIteratorTag) { return last - first; } template inline size_t _Distance(InputIterator first, InputIterator last, InputIteratorTag) { size_t n = 0; while (first != last) { ++first; ++n; } return n; }