TeamHypersomnia/rectpack2D

c++20(latest) causes compile error on calling find_best_packing()

TomTheFurry opened this issue · 5 comments

Compiled using Visual Studio 2019 (v142) with /std:c++latest.
Only an issue if you use /std:c++latest

Compiler output:

1>C:\...\Include\finders_interface.h(104,14): error C2065: 'orders': undeclared identifier

1>C:\...\Include\finders_interface.h(78): message : see reference to function template instantiation 'auto rectpack2D::find_best_packing::<lambda_1>::operator ()<Comparator>(_T1 &) const' being compiled
1>        with
1>        [
1>            Comparator=rectpack2D::find_best_packing::<lambda_1>,
1>            _T1=rectpack2D::find_best_packing::<lambda_1>
1>        ]

1>C:\...\Include\finders_interface.h(151): message : see reference to function template instantiation 'rectpack2D::rect_wh rectpack2D::find_best_packing<empty_spaces_type,F,G,rectpack2D::find_best_packing::<lambda_1>,rectpack2D::find_best_packing::<lambda_2>,rectpack2D::find_best_packing::<lambda_3>,rectpack2D::find_best_packing::<lambda_4>,rectpack2D::find_best_packing::<lambda_5>,rectpack2D::find_best_packing::<lambda_6>>(std::vector<rectpack2D::space_rect,std::allocator<rectpack2D::space_rect>> &,const rectpack2D::finder_input<F,G> &,Comparator,rectpack2D::find_best_packing::<lambda_2>,rectpack2D::find_best_packing::<lambda_3>,rectpack2D::find_best_packing::<lambda_4>,rectpack2D::find_best_packing::<lambda_5>,rectpack2D::find_best_packing::<lambda_6>)' being compiled
1>        with
1>        [
1>            empty_spaces_type=spaces_type,
1>            F=FontManager::loadFont::<lambda_1>,
1>            G=FontManager::loadFont::<lambda_2>,
1>            Comparator=rectpack2D::find_best_packing::<lambda_1>
1>        ]

1>C:\...\myOwnFile\Font.cpp(108): message : see reference to function template instantiation 'rectpack2D::rect_wh rectpack2D::find_best_packing<spaces_type,F,G>(std::vector<rectpack2D::space_rect,std::allocator<rectpack2D::space_rect>> &,const rectpack2D::finder_input<F,G> &)' being compiled
1>        with
1>        [
1>            F=FontManager::loadFont::<lambda_1>,
1>            G=FontManager::loadFont::<lambda_2>
1>        ]

1>C:\...\Include\finders_interface.h(104,33): error C2065: 'orders': undeclared identifier

1>C:\...\Include\finders_interface.h(104,9): error C2672: 'sort': no matching overloaded function found

1>C:\...\Include\finders_interface.h(106,3): error C2780: 'void std::sort(_ExPo &&,const _RanIt,const _RanIt) noexcept': expects 3 arguments - 2 provided

1>C:\...\algorithm(7584): message : see declaration of 'std::sort'

1>C:\...\Include\finders_interface.h(106,3): error C2780: 'void std::sort(_ExPo &&,_RanIt,_RanIt,_Pr) noexcept': expects 4 arguments - 2 provided

1>C:\...\algorithm(7581): message : see declaration of 'std::sort'

1>C:\...\Include\finders_interface.h(106,3): error C2780: 'void std::sort(const _RanIt,const _RanIt,_Pr)': expects 3 arguments - 2 provided

1>C:\...\algorithm(7567): message : see declaration of 'std::sort'

more details:

using spaces_type = rectpack2D::empty_spaces<false, rectpack2D::default_empty_spaces>;
using rect_type = rectpack2D::output_rect_t<spaces_type>;
std::vector<rect_type> rects{};
...
uint maxSize = ...
const auto discard_step = -4;
uint counter = 0;
const auto result_size = rectpack2D::find_best_packing<spaces_type>(
	rects,
	rectpack2D::make_finder_input(
		maxSize, discard_step,
		[&counter](rect_type&) {
			counter++;
			return rectpack2D::callback_result::CONTINUE_PACKING;
		},
		[](rect_type&) {return rectpack2D::callback_result::ABORT_PACKING;},
		rectpack2D::flipping_option::DISABLED
	)
);
...

I have the save issue...

me three, please help @geneotech @Longri

use c++17 may fix this

I apologize for the delay, I was a little busy. Indeed, there was a minor problem with the syntax. It should build fine now!