我想在windows中编译nghttp2,opensource。我已经在Linux中成功编译了。在Visual Studio中std :: begin和std :: end迭代器
我面临从下面的一段代码编译错误。 *
template <size_t N> struct Memchunk {
public:
Memchunk(Memchunk *next_chunk)
: pos(std::begin(buf)), last(pos), knext(next_chunk), next(nullptr) {}
size_t len() const { return last - pos; }
size_t left() const { return std::end(buf) - (const size_t) last; }
void reset() { pos = last = std::begin(buf); }
std::array<uint8_t, N> buf;
uint8_t *pos, *last;
Memchunk *knext;
Memchunk *next;
static const size_t size = N;
};
*
我收到以下错误。
error C2440: 'return': cannot convert from'std::_Array_const_iterator<_Ty,16384>' to 'std::size_t'
我在Linux中没有遇到上述错误。我是否缺少特定于Visual Studio的内容?
看起来很不好C++代码。 – Stargateur
gcc也不喜欢它。 http://ideone.com/SJNXbJ。什么编译器接受这个?这个错误对我来说很有意义。 – Persixty
为什么不'std :: array :: iterator pos,last;'?我不明白。 –
ZDF