बजना 3.8.1 ++ निम्नलिखित कार्यक्रम संकलित libc साथ: libstdc साथबजना बनाम जीसीसी std :: बढ़ावा साथ crbegin :: iterator_range
#include <vector>
#include <iterator>
#include <algorithm>
#include <iostream>
#include <boost/range/iterator_range.hpp>
int main()
{
const std::vector<int> v {1, 2, 3};
const auto range = boost::make_iterator_range(v);
std::copy(std::crbegin(range), std::crend(range), std::ostream_iterator<int> {std::cout, " "});
std::cout << std::endl;
return 0;
}
लेकिन जीसीसी 6.1.0 ++ नहीं करता है। जीसीसी त्रुटि की पहली पंक्ति है:
error: no matching function for call to 'crbegin(const boost::iterator_range<__gnu_cxx::__normal_iterator<const int*, std::vector<int> > >&
कौन सही है?
नोट: बूस्ट संस्करण 1,61
जीसीसी क्या त्रुटियां देता है? – aschepler
@aschepler मैंने त्रुटि की पहली पंक्ति जोड़ दी है - शेष में ज्यादा कुछ नहीं जोड़ा गया है। 'Std :: crend' के लिए वही। मुझे लगता है कि जीसीसी यहाँ सही है - 'boost :: iterator_range' में' rbegin' या 'rend' सदस्य विधि नहीं है। मैं समझ में नहीं आता कि क्लैंग कैसे बना रहा है! – Daniel
@Daniel: क्या आप libC++ या libstdC++ के साथ क्लैंग का उपयोग कर रहे हैं? यदि पूर्व, संभवतः यह 'std :: make_reverse_iterator (range.begin()) 'को कॉल करता है, यदि कोई' rbegin' सदस्य फ़ंक्शन मौजूद नहीं है। यदि उत्तरार्द्ध, तो वास्तव में अच्छा सवाल ... – ildjarn