Orxonox goes C++11
Posted: Mon Nov 02, 2015 10:22 pm
We're about to move to C++11!
Everyone who's interested in the topic can have a look at branch cpp11_v2: http://www.orxonox.net/browser/code/branches/cpp11_v2
You're welcome to test the branch, see if it compiles and works for you, and to add your favorite C++11 features to Orxonox!
To use all features of C++11 you will probably need at least the following compiler versions to build Orxonox:
- GCC: 4.8
- MSVC: 2014
Of course this depends on the features of C++11 that we will actually use in the end.
Anyway, the trunk of Orxonox works with said compiler versions (including precompiled dependencies for windows).
If you're currently not in the mood to introduce new C++11 features yourself in the code, you can still use this thread to add your suggestions.
Here's the current list of suggestions ([x] means done, updated 31. dec 2015):
[x] Use constexpr for Math.h functions (and other constants) [done: 1. nov 2015 by landauf]
[x] Add move-constructor for StrongPtr and SharedPtr [done: 1. nov 2015 by landauf] (are there other places where we could use this?)
[x] ObjectList should support range-based-for-loops [done: 31. oct 2015 by bknecht & landauf]
[x] Replace the usage of ObjectListIterator with range-based-for-loops [done: 5. dec 2015 by landauf]
[x] Replace iteration over standard containers with range-based-for-loops [done: 21. nov 2015 by muemart]
[x] Introduce lambda functions for timers, callbacks and generally for all kinds of Functors [done: 23. dez 2015 by muemart]
[x] Use constructor delegation where it makes sense [done: 29. dec 2015 by landauf] (are there other places where we could use this?)
[x] Use default and delete for constructors (specially for non-copyable classes) [done: 29. dec 2015 by landauf]
[x] Use 'override' for overridden virtual functions [done: 19. nov 2015 by muemart]
[x] Replace NULL (or 0) by nullptr [done: 6. nov 2015 by landauf]
[x] Use enum class (instead of the legacy enums) [done: 30. dec 2015 by landauf]
[x] Replace "> >" by ">>" [done: 7. nov 2015 by landauf]
[x] Make conversion-to-bool-operator explicit in all our smart-pointers [done: 7. nov 2015 by landauf]
[x] Use variadic templates for functor [done: 27. nov by muemart]
[x] Use static_assert instead of the boost macro STATIC_ASSERT [done: 7. nov 2015 by landauf] (are there other places where we could use this?)
[x] IdentifierManager should store Identifiers by type_index [done: 28. dec 2015 by landauf]
[x] Replace std::auto_ptr with std::unique_ptr [done: 7. nov 2015 by landauf]
[x] Use new features from the standard library instead of boost (e.g. shared_ptr, bind, etc.) [done: 8. nov 2015 by landauf]
[x] Use new random number generator instead of rand() [done: 17. nov 2015 by muemart]
[x] Replace SharedPtr with std::shared_ptr [done: 22. nov 2015 by landauf]
[x] Use the chrono library to add milliseconds to the timestamp in logfiles [done: 29. dec 2015 by landauf]
[-] ?? Maybe we can use the alignment specifiers (alignas/alignof) in WorldEntity to replace the new/delete-overloads? -> Update (31. dec 2015 by landauf): No this cannot replace the new/delete-overloads. However, alignas(16) could be used to replace bullet's ATTRIBUTE_ALIGNED16 (but that's none of our business).
Everyone who's interested in the topic can have a look at branch cpp11_v2: http://www.orxonox.net/browser/code/branches/cpp11_v2
You're welcome to test the branch, see if it compiles and works for you, and to add your favorite C++11 features to Orxonox!
To use all features of C++11 you will probably need at least the following compiler versions to build Orxonox:
- GCC: 4.8
- MSVC: 2014
Of course this depends on the features of C++11 that we will actually use in the end.
Anyway, the trunk of Orxonox works with said compiler versions (including precompiled dependencies for windows).
If you're currently not in the mood to introduce new C++11 features yourself in the code, you can still use this thread to add your suggestions.
Here's the current list of suggestions ([x] means done, updated 31. dec 2015):
[x] Use constexpr for Math.h functions (and other constants) [done: 1. nov 2015 by landauf]
[x] Add move-constructor for StrongPtr and SharedPtr [done: 1. nov 2015 by landauf] (are there other places where we could use this?)
[x] ObjectList should support range-based-for-loops [done: 31. oct 2015 by bknecht & landauf]
[x] Replace the usage of ObjectListIterator with range-based-for-loops [done: 5. dec 2015 by landauf]
[x] Replace iteration over standard containers with range-based-for-loops [done: 21. nov 2015 by muemart]
[x] Introduce lambda functions for timers, callbacks and generally for all kinds of Functors [done: 23. dez 2015 by muemart]
[x] Use constructor delegation where it makes sense [done: 29. dec 2015 by landauf] (are there other places where we could use this?)
[x] Use default and delete for constructors (specially for non-copyable classes) [done: 29. dec 2015 by landauf]
[x] Use 'override' for overridden virtual functions [done: 19. nov 2015 by muemart]
[x] Replace NULL (or 0) by nullptr [done: 6. nov 2015 by landauf]
[x] Use enum class (instead of the legacy enums) [done: 30. dec 2015 by landauf]
[x] Replace "> >" by ">>" [done: 7. nov 2015 by landauf]
[x] Make conversion-to-bool-operator explicit in all our smart-pointers [done: 7. nov 2015 by landauf]
[x] Use variadic templates for functor [done: 27. nov by muemart]
[x] Use static_assert instead of the boost macro STATIC_ASSERT [done: 7. nov 2015 by landauf] (are there other places where we could use this?)
[x] IdentifierManager should store Identifiers by type_index [done: 28. dec 2015 by landauf]
[x] Replace std::auto_ptr with std::unique_ptr [done: 7. nov 2015 by landauf]
[x] Use new features from the standard library instead of boost (e.g. shared_ptr, bind, etc.) [done: 8. nov 2015 by landauf]
[x] Use new random number generator instead of rand() [done: 17. nov 2015 by muemart]
[x] Replace SharedPtr with std::shared_ptr [done: 22. nov 2015 by landauf]
[x] Use the chrono library to add milliseconds to the timestamp in logfiles [done: 29. dec 2015 by landauf]
[-] ?? Maybe we can use the alignment specifiers (alignas/alignof) in WorldEntity to replace the new/delete-overloads? -> Update (31. dec 2015 by landauf): No this cannot replace the new/delete-overloads. However, alignas(16) could be used to replace bullet's ATTRIBUTE_ALIGNED16 (but that's none of our business).