#basic forward iterator c++23

37 messages · Page 1 of 1 (latest)

near deltaBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

runic zinc
#

stl_iterator_base_funcs.h(205, 7): Error occurred here

main.cpp(23, 10): In instantiation of function template specialization 'std::advance<cvk::generator<Board::pair_depth>::iterator, int>' requested here```
#

this time it 100% iterator and not range itself yamikek

autumn rivet
#

you have using difference_t =... should be using difference_type = ...

runic zinc
autumn rivet
#

I tend to do that often too

runic zinc
#

std::iter_difference_t

#

trait

#

...

autumn rivet
#

the general rule is anything at namespace level gets _t, and dependant types get _type (iter_value_t vs iterator::value_type)

runic zinc
#

it still not work hmmge

autumn rivet
#

new error or same?

runic zinc
#

same...

#
[build] /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_iterator_base_funcs.h:205:49: error: no type named 'difference_type' in 'std::iterator_traits<cvk::generator<Board::pair_depth>::iterator>'
[build]   205 |       typename iterator_traits<_InputIterator>::difference_type __d = __n;
[build]       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
[build] /home/charaverk/hexchess/server/src/main.cpp:23:10: note: in instantiation of function template specialization 'std::advance<cvk::generator<Board::pair_depth>::iterator, int>' requested here
[build]    23 |     std::advance(depth,1);
[build]       |          ^
[build] 1 error generated.

both in build and clangd

#

wait forward iterator require ()++

#

it not satisfy regular concept

#

so, compare to default sentient is OPTIONAL and not alternative to compare to self

#

it still need to be able to compare itself

#

actually make sense

#

i just deduce to use static assert of concept by this type

#

after 30 min

#

can i somehow avoid it?

#

i mean only if i make it output?

autumn rivet
#

You can make it an output iterator, but if you want to read it should be an input iterator

runic zinc
#

nvm i just stupid some times, it actually should be input_or_output iterator only

autumn rivet
#

input iterator only requires operator++ and comparison to sentinal type

#

output iterator is similar, except operator* doesn't have to return a reference

near deltaBOT
#

@runic zinc

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.

runic zinc
#

so it not delete entire post

#

!solved

near deltaBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

runic zinc
#

(not solved), i cant have operator++(int) with this semantics, without it not even satisfy input iterator

#

so i just decide i will use raw operation and not iterators functions for this one

autumn rivet
#

I think you just have to define operator++(int) and live with the fact that it's wrong