CNES / EleFits

A modern C++ API on top of CFitsIO
https://cnes.github.io/EleFits
Other
13 stars 5 forks source link

Warnings with GCC 11.2.0 (use reference type loop) #26

Closed grizonnetm closed 1 year ago

grizonnetm commented 2 years ago
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp: In member function ‘void Raster_test::sectionning_test::test_method()’:
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp:175:19: warning: loop variable ‘p’ creates a copy from type ‘const Euclid::Fits::Position<3>’ [-Wrange-loop-construct]
  175 |   for (const auto p : section3D.domain()) {
      |                   ^
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp:175:19: note: use reference type to prevent copying
  175 |   for (const auto p : section3D.domain()) {
      |                   ^
      |                   &
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp:182:19: warning: loop variable ‘p’ creates a copy from type ‘const Euclid::Fits::Position<2>’ [-Wrange-loop-construct]
  182 |   for (const auto p : section2D.domain()) {
      |                   ^
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp:182:19: note: use reference type to prevent copying
  182 |   for (const auto p : section2D.domain()) {
      |                   ^
      |                   &
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp:189:19: warning: loop variable ‘p’ creates a copy from type ‘const Euclid::Fits::Position<1>’ [-Wrange-loop-construct]
  189 |   for (const auto p : section1D.domain()) {
      |                   ^
/home/grizonnetm/projets/euclid/src/EleFits/EleFitsData/tests/src/Raster_test.cpp:189:19: note: use reference type to prevent copying
  189 |   for (const auto p : section1D.domain()) {
kabasset commented 2 years ago

Thanks! Those should indeed be refrerences (const auto& p)