core icon indicating copy to clipboard operation
core copied to clipboard

Replace deprecated `std::iterator`

Open Sichao25 opened this issue 7 months ago • 7 comments

std::iterator is set to be deprecated in C++17. See more explanations here. Its usage should be replaced to ensure compatibility with newer C++ standards.

Sichao25 avatar Apr 24 '25 19:04 Sichao25

@Sichao25 Thank you. This was found when building with C++20?

cwsmith avatar Apr 24 '25 20:04 cwsmith

Yes. The related usage is pumi/pumi_list.h.

Sichao25 avatar Apr 24 '25 20:04 Sichao25

If we're making changes to support later C++ standards, I would like to see APF_ITERATE deprecated. If there are internal uses they should probably be range-based for loops.

bobpaw avatar Apr 24 '25 22:04 bobpaw

I played around with the idea of proper iterator support for PUMI meshes a long time ago. There is one subtle point that makes that tricky. The range-based for loops rely on begin and end. However, for a mesh, we may want to loop over all dimensions, or just a single dimension. I'm sure there is some interface that makes sense and can support that I just am not 100% sure what it looks like.

jacobmerson avatar Apr 30 '25 14:04 jacobmerson

I'm talking specifically about the STL iteration helpers in apf.h: https://github.com/SCOREC/core/blob/17ad033da30c8079a69e8142486ce01892c562b8/apf/apf.h#L634-L649

bobpaw avatar May 01 '25 18:05 bobpaw

@bobpaw is there a strong reason to replace these? It seems like it will be more effort than it's worth to remove it.

jacobmerson avatar May 01 '25 20:05 jacobmerson

Nope, just a wish-list item.

bobpaw avatar May 02 '25 18:05 bobpaw

closed with https://github.com/SCOREC/core/pull/482

cwsmith avatar Jul 24 '25 14:07 cwsmith