−1
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Antony Polukhin
in
pro.cxx
Кстати, в EWG одобрили constexpr контейнеры http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0784r1.html
так что есть все шансы к С++20 писать:
constexpr std::string result = foo();
t.me/ProCxx
/184343
Mar 16 at 10:47
Library pragmatism
Current implementations of standard libraries sometimes perform various raw storage operations through interfaces other than the standard allocator and allocator traits. That may make it difficult to make the associated components usable in constexpr components. Based on a cursory examination of current practices, we therefore propose to start only with the requirement that the container templates in the [containers] clause be usable in constexpr evaluation, when instantiated over literal types and the default allocator. In particular, this excludes std::string, std::variant, and various other allocating components. Again, it is our hope we will be able to extend support to more components in the future.
With regards to the default allocator and allocator traits implementation, the majority of the work is envisioned in the constexpr evaluator: It will recognize those specific components and implement their members directly (without necessarily regarding the library definition).
We might, however, consider decorating the class members with the constexpr keyword. Also, some implementations provide extra members in these class templates (such as libc++'s allocator_traits<A>::__construct_forward ) that perform non-constexpr-friendly operations (memcpy, in particular). Lifting such members to standard status would help interoperability between library and compiler implementations.
Запостил: j123123,
16 Марта 2018
j123123 16.03.2018 17:51 # −1
subaru 16.03.2018 18:23 # −1
Antervis 18.03.2018 18:39 # −1
subaru 18.03.2018 19:06 # −1
SemaReal 16.03.2018 18:49 # +2
Так вот и крестовик скоро развалится на С++ devloper и, собссно, template (compile-time? constexpr?) engineer
g0_1494076596974 16.03.2018 19:05 # 0
bormand 16.03.2018 19:08 # +2
SemaReal 16.03.2018 19:10 # 0
В начале нулевых далёкий от веба люд называл вебмастеров "дизайнерами".
На пхп пишут дизайнеры
Так-то
g0_1494076596974 16.03.2018 20:04 # 0
SemaReal 16.03.2018 21:03 # 0