https://github.com/florianbecker/pseudo_cpp11
C++11 compatibility layer for old projects
https://github.com/florianbecker/pseudo_cpp11
compatibility cpp cpp03 cpp11 cpp14 cpp17 cpp98 fake noreturn visual-studio
Last synced: 3 months ago
JSON representation
C++11 compatibility layer for old projects
- Host: GitHub
- URL: https://github.com/florianbecker/pseudo_cpp11
- Owner: florianbecker
- License: bsd-3-clause
- Created: 2021-02-18T09:28:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-02T21:55:34.000Z (about 4 years ago)
- Last Synced: 2025-03-10T12:57:05.734Z (3 months ago)
- Topics: compatibility, cpp, cpp03, cpp11, cpp14, cpp17, cpp98, fake, noreturn, visual-studio
- Language: CMake
- Homepage: https://vxapps.com
- Size: 39.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pseudo_cpp11
C++11 compatibility layer for old projects.This will help you to port a C++98 project easily to C++11 and above.
## Usage
```cpp
#include
```## Keywords for C++98
Some are fake, some are functional, but all are direct compileable with --std=c++11
- explicit // (only fake)
- noexcept // (only functional on clang and gcc)
- override // (only fake)
- final // (only fake)
- nullptr
- constexpr## Macros
### Keywords
- DEFAULT as = default; // (only fake)
- DELETE as = delete; // (only fake)### Attributes
- DEPRECATED as [[deprecated]]
- NORETURN as [[noreturn]] // (only functional on Visual Studio)
- NODISCARD as [[nodiscard]] // (only functional on clang and gcc)
- MAYBE_UNUSED as [[maybe_unused]] // (only functional on clang and gcc)
- UNUSED as (void) - not explicit C++11, but to compress compiler warnings until the project convertion is done.## Loop
foreach macro
Visual Studio example:
```cpp
foreach ( const int &_value, container ) {std::cout << "Value: " << _value << std::endl;
}
```Other example:
```cpp
foreach ( _value, container ) {std::cout << "Value: " << ( *_value ) << std::endl;
}
```## Not working
This helper is mostly for porting to C++11 and above, so this features will not work within this project:
- auto keyword
- using keyword
- initializer_list
- lambda functions
- variadic templates
- other specific C++11 features, not explicit listed here## User-defined build variables
Inside cmake/env.cmake you will find some user-defined build variables for particular purposes.### Debugging
You can log the verbose build output.
```cmake
# Debugging of build steps
set(CMAKE_VERBOSE_MAKEFILE ON)
```### C++ Standard
You can build the example with C++11 and above standard.
```cmake
# c++ standard - possible: 98, 11, 14, 17
set(CMAKE_CXX_STANDARD 11)
```## Support
- from Microsoft Visual Studio 2008
- Clang >= 8 (Earlier not tested)
- GCC >= 7 (Earlier not tested)