Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile in C++17 #56

Closed
ville-v opened this issue Jul 14, 2022 · 6 comments
Closed

Does not compile in C++17 #56

ville-v opened this issue Jul 14, 2022 · 6 comments

Comments

@ville-v
Copy link

ville-v commented Jul 14, 2022

std::unary_function is removed in C++17, therefore nanort.h does not compile. https://en.cppreference.com/w/cpp/utility/functional/unary_function

Tested in Visual Studio 2022.

@dalerank
Copy link
Owner

can u fix it with pr?

@ville-v
Copy link
Author

ville-v commented Jul 15, 2022

I don't know what this class does (how to replace it) and the original nanogui does not have this file. So I used another GUI library instead.

@Soldy
Copy link
Contributor

Soldy commented Jul 20, 2022

@dalerank
Copy link
Owner

Sure, is it new version?

@Soldy
Copy link
Contributor

Soldy commented Jul 20, 2022

Sure, is it new version?

Something like a new version with an other problem:
https://github.com/lighttransport/nanort/blob/0bfd8fa97e979b3636136840cbe6cc70b8bc9f08/nanort.h#L131

 class StackAllocator : public std::allocator<T> {

https://en.cppreference.com/w/cpp/memory/allocator

So isn't work with c++20

But is there anyway.

class StackAllocator : public std::allocator<T> {

@ville-v
Copy link
Author

ville-v commented Jul 20, 2022

I think std::allocator_traits can replace std::allocator. Nanogui-sdl uses std::allocator in some other places and replacing those was recommended by Visual Studio.

https://en.cppreference.com/w/cpp/memory/allocator_traits

According to this, std::allocator is removed because it is (at least partially) duplicate of std::allocator_traits: https://stackoverflow.com/questions/39414610/why-are-are-stdallocators-construct-and-destroy-functions-deprecated-in-c17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants