bdc54835c2
- updated CMake build script - builds with Microsoft C++ 19.1x. such builds require Windows 8.1 or later unless you have the .NET Server 2003-toolset (v141_xp) - windows port requires a C++17 compiler since cpp17::filesystem is POSIX-only - HAVE_CXX17_FILESYSTEM manual toggle in CMake. You must manually specify where std::[experimental::]filesystem is defined in LDFLAGS or CMAKE_x_LINKER_FLAGS. - IPv6 support can be added at any time, and the windows sdk still has that inline getaddrinfo(3) if it can't find a suitable IPv6 stack. - inline code for mingw-w64: there's a few bits and pieces still missing simply because mingw-w64 derives its windows sdk from wine and reactos, and then writing all the newer stuff into it by hand straight from the MSDN manpages. - misc. C++11 stuff (nullptr and friends) - Internal file handling code takes UTF-8 or plain 8-bit text, NTFS is UTF-16, so std::filesystem::path::c_str() is wchar_t. That's no good unless you first call std::filesystem::path::string(). - implemented getifaddrs(3) and if_nametoindex(3) on top of GetAdapters[Info|Addresses](2). - updated readme with new info BONUS: may implement Solaris/illumos IOCP someday... -despair86 |
||
---|---|---|
.. | ||
lib | ||
.gitignore | ||
cppbackport.config | ||
cppbackport.creator | ||
cppbackport.files | ||
cppbackport.includes | ||
LICENSE | ||
make.inc | ||
README.md |
This is a backport of the current C++ standard library to C++03/11/14. Obviously not everything can be backported, but quite a bit can.
Quick Start
There are a couple of small examples to give you an idea of usage. If you have make and g++ you can build things quickly enough:
- clone the repo to /some/place/cppbackport
- make a temp dir /wherever/you/wanna/build
- cd /wherever/you/wanna/build
- make -f /some/place/cppbackport/examples/Makefile
The examples are all setup to compile the cppbackport files as a static library (libcppbackport.a), and then link it with one of the main example files (ex., gibberish.cpp).
Installation
I recommend copying the lib directory into your project, and calling the included Makefile to create libcppbackport.a. Link that into your project, and add the appropriate include flags (ex., -iquotecppbackport).
Usage
Basically, #include "filesystem.h" or similar. Then use cpp namespace in place of std namespace. The headers are all named after their official counterparts, with the addition of the .h extension.
FAQ
Who is this library suitable for?
Anyone, really. There are a few use cases:
- The primary use case is to provide some newer features to people who are stuck with/choose to use an older compiler
- Another use would be to soften the requirements of your own project (i.e., so your users can use an older compiler)
- In some cases, this project may provide usable code before compilers support a standard. For example, C++17 at the moment isn't even standardized, but we basically know what's in it so we can start supporting it.
What's the license?
BSD 3-clause. Use it. Contribute if you like. Don't blame us for things.
What compiler(s)/platforms are supported
The development environment is Fedora 24 with GCC 6.1.1. I've used it with earlier versions
of GCC (4.7.4, I think), and a semi-recent version of Clang. I've not tested under Windows, yet.
Will this use C++11/14/17 if available?
Yes. Based on the value of the __cplusplus define, the files will simply #include the
system header (as appropriate).
Why not header-only?
I actually like the interface/implementation distinction. Header-only implementations (IMO)
get way too large and the files are difficult to navigate. Also, save the compiler some work.
Also, installing a lib isn't really that hard.
Does it work on Windows?
Sorry, POSIX mostly. Would love for some Windows devs to help.
Why not use Boost?
There's some overlap, but there are differences, too. And none of these things, individually
are that big.