tqdm / tqdm.cpp

C++ port of tqdm
Other
312 stars 28 forks source link

Drops 'const' qualifier #48

Open amallia opened 6 years ago

amallia commented 6 years ago

Getting the following error:

/Users/amallia/Development/sera/external/tqdm.cpp/include/tqdm/utils.h:106:12: error: binding value of type 'const std::__1::iterator<std::__1::forward_iterator_tag, ds2i::binary_freq_collection::sequence, long,
      ds2i::binary_freq_collection::sequence *, ds2i::binary_freq_collection::sequence &>::value_type' (aka 'const ds2i::binary_freq_collection::sequence') to reference to type
      'tqdm::MyIteratorWrapper<ds2i::binary_freq_collection::iterator>::value_type' (aka 'ds2i::binary_freq_collection::sequence') drops 'const' qualifier
    return *p;
           ^~
/Users/amallia/Development/sera/src/create_freq_index.cpp:69:23: note: in instantiation of member function 'tqdm::MyIteratorWrapper<ds2i::binary_freq_collection::iterator>::operator*' requested here
    for (auto &&plist : tqdm::tqdm(input)) {
casperdcl commented 6 years ago

if you remove tqdm::tqdm from the last line (leaving input unwrapped) does it work?

amallia commented 6 years ago

Yes. Of course

amallia commented 6 years ago

This is the iterator:

        class iterator : public std::iterator<std::forward_iterator_tag,
                                              sequence> {

if I change it like this it works:

        class iterator : public std::iterator<std::forward_iterator_tag,
                                              const sequence> {

But i feel there is also a bug in tqdm