-
Notifications
You must be signed in to change notification settings - Fork 439
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
C++14, C++17 and forward #52
Comments
From experience with working with MSVC 2013, the C++11 support they added (at least |
Hmm what about to move everything to Clang (not GCC or MSVC) ? They are doing really good work, also with support for Windows platform: https://clang.llvm.org/docs/MSVCCompatibility.html Also MSVC installer actually have an option to install Clang with it (old version 6.0 i think). I think, just wait only 5 months or 1 year and Clang will take over the MSVC compiler (I seen tweets that Clang actually started destroying MSVC compiler - they just moved from it) :D I'm talking here about MSVC because is the most problematic platform. On Linux and Mac users can use Clang without any problems, but on Windows only MSVC or Cygwin-like stuff. |
There are embedded Linux platforms that don't have the option to use Clang instead of GCC and I have important clients on these -- can't just drop GCC support :) Besides that, at the moment it's possible to just use a stock Ubuntu with whatever GCC is installed on it and that's a nice "plug and play" feature I wouldn't want to lose. I'll introduce support for C++14 and 17 features on an opt-in basis (for example enabling |
@mosra C++20 mentioned, yeah 😛 |
Closing as most of the checklist above is implemented. The remaining bits are tracked in various project cards, in particular the Corrade / Containers project, features from newer C++ standards are going to be added on an as-needed / as-requested basis. |
This used to be a list of exciting new features present in newer C++ standards to look forward to. Now it's rather a list of non-insance C++14+ features that could be worth backporting to C++11.
C++14
CORRADE_CXX_STANDARD
CMake property and preprocessor macroCORRADE_CONSTEXPR14
-- mosra/corrade@9cf91f0std::integer_sequence
optimizations -- mosra/corrade@0b82814Compiler support
For all compilers we need to wait until their usage is similar to GCC 4.7 and Clang 3.2 just now (May 2014).We'll see after dropping GCC 4.7 support (#274).Good resources about compiler support are at http://www.g-truc.net/project-0036.html for major vendors and also at http://en.cppreference.com/w/cpp/compiler_support for the other.
Features
constexpr
-- it would be finally possible to implement compile-time MurmurHash without the code being write-only, also many math functions will benefit from that (so the user doesn't need to precompute math operations in tight loops by hand, but can just slapconstexpr
specifier on the result and be done with it). Experimental stuff already available incpp14
branch.Pi<float>
) -- not sure about the usage, the current way with enums and functions ensures that the value is not exposed as any linkable symbol (you can't take address of enum or function result), which in my opinion is exactly what we want for constants -- to be always on stack and not referenced through some slow indirection. Also this (from API perspective) is easily doable using template aliases, am I missing something?1 << n
is much more readableactually no, the attribute can be used for enums and namespaces only since C++17, so the macro is going to stay[[deprecated]]
attribute might help with getting rid of the uglyCORRADE_DEPRECATED()
macro and its compiler-specific quirksmake use of feature test macros for C++14+ features instead of relying on STL/compiler version checkshahahah you wish, as long as compilers are buggy this is only a wet dreamSTL features
The issue is that these won't be advertised in compiler release changelogs and thus we might have some very nasty surprises (e.g.
std::map::emplace()
didn't exist until GCC 4.8).this proposal disappeared somehowstd::float32_t
andstd::float64_t
instead offloat
anddouble
, just to be consistent with strict type definitions we already have for integersnot worth the backwards compatibility painstd::enable_if_t<...>
instead oftypename std::enable_if<...>::type
(and similar) -- 13 characters shorter, will help a lot in implementation details of generic classesnope, making my own thingstd::make_unique()
for much less verbosestd::unique_ptr
construction-- could also implement my own, and wasn't all that essential after allstd::exchange()
utility function instead of the following fugly piece of codeno, they don't, gah; having my own StringView (and string literals) nowadaysstd::string
literals, I hope they help with avoiding the copy and allocation on construction, otherwise I can't think of any other use case (apart from proper'\0'
handling)C++17
CORRADE_CXX_STANDARD
CMake property and preprocessor macroposix_memalign()
on pre-C++17 -- mosra/corrade@c095551Array
/ArrayTuple
if dealing with over-aligned types[[deprecated]]
!) for namespaces, enums and enum values (for enums this somehow already works in Clang C++11) -- currently used inCORRADE_DEPRECATED_ENUM()
macroContainers::Optional
withstd::optional
Containers::StringView
withstd::string_view
-- mosra/corrade@cf0bd1fCompiler support
Features
template argument deduction for class templates -- obsoletes all-- thanks to our naming scheme, the "make" helpers are not any longer than using the class name directly (make*()
helperspointer()
vsPointer
), so this is a non-issue-- useful for user code, not library code, there we should provide a message alwaysstatic_assert()
without messageSTL features
sorry, bad jokestd::observer_ptr
instead of raw pointersnot worth the backwards compatibility painstd::is_integral_v<...>
instead ofstd::is_integral<...>::value
(and similar) - 5 characters shorter (slower compile times?)std::void_t
(N3911) has an interesting example to simplifyCORRADE_HAS_TYPE()
macroconstructing-- I basically bannedstd::tuple
with just{}
std::tuple
from the codebase sinceuninitialized_value_construct()
etc. as more optimal alternatives to placement-new-in-a-loop inContainers::Array
NoInit
and other versions (but one needs<memory>
for that, ugh)finally a crossplatform filesystem handling to replace our own incompletely testedI doubt it will ever catch up with my requirements, also there's a very small intersection between what I need (Corrade::Utility::Directory
isSandboxed()
) vs what it provides (operator/
for concatenating directories, wtf)C++20
CORRADE_CXX_STANDARD
CMake property and preprocessor macroContainers::ArrayView
withstd::span
Features
__VA_OPT__
, like__VA_ARGS__
, but allowed to be emptynew
to avoid unnecessary reallocations#include
system -- though probably DOA, not speeding up anythingGL::defaultFramebuffer
to be initialized using a constant expression, but then used as a mutable instance?constexpr
, but enforcing that the function call is actually done at compile time (instead of just making it possible)STL features
make use of std::is_constant_evaluated() ... why this wasn't there since c++11?!Utility::format()
is already much faster than fmtlib at compile time and could be also faster at runtime, once I get my hands on it.C++23
Features
#elifdef
/#elifndef
; I wonder when it will make sense to upgrade to C++23 just to get these (or maybe they'll be usable even wiithout picking the full standard?)operator[]
where I can use,
, finallyStridedArrayView
, and anoperator()
fallback until thenMatrix
, and anoperator()
fallback until thenSTL features
<stacktrace>
Not yet
StridedArrayView
withstd::mdspan
variable-length arrays, which will avoid heap allocations in some cases. Main use case is convertingtoo slow, error prone and dangerous, won't use that ever (case in point: Linux kernel removed them all for better stability)std::initializer_list<T>
parameters toGLuint[]
when passing them toglBindTextures()
,glShaderSource()
and other "multi" functions. Not part of C++14, but available in GCC since forever as GNU extension and it is made "official" in 4.9. Clang originally chose to not implement this at all, so it's not available in it yet. On the other hand, if I'm lucky I might be able to work around the allocation with some implicit conversions and then pass thestd::initializer_list
data directly.std::vector::release() and an "acquire" counterpart-- rejected from C++17, nobody cared since then, and I have switched to my own containers anywayThe text was updated successfully, but these errors were encountered: