vendredi 17 juillet 2020

make_heap and pop_heap are OK but push_heap not

I just came across a weird problem that happens only on MSVC with Clion but not on other compilers(I tried gcc on Linux and Visual Studio both no such problem, with the same code).

With these codes:

#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int>v = {1,2,3,4,5};
    make_heap(v.begin(), v.end());
    v.push_back(6);
    push_heap(v.begin(), v.end());
}

an error "In instantiation of function template specialization 'std::push_heapstd::_Vector_iterator<std::_Vector_val<std::_Simple_types<int > > >' no type named 'value_type' in 'std::indirectly_readable_traitsstd::_Vector_iterator<std::_Vector_val<std::_Simple_types<int > > >'" will then be shown

enter image description here

is it a bug of Clion or MSVC?

Aucun commentaire:

Enregistrer un commentaire