Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[3.145.97.109] |
|
Страницы: (77) « Первая ... 54 55 [56] 57 58 ... 76 77 ( Перейти к последнему сообщению ) |
Сообщ.
#826
,
|
|
|
Я там выше написал, что посмотрел в malloc.h как объявлены _alloca и alloca. Там написано, что
#define alloca(x) __builtin_alloca((x)) |
Сообщ.
#827
,
|
|
|
А вот и свеженький драфт C++14.
Добавлено Бинго! init-capture попала в стандарт! И auto-тип для аргументов лямбд тоже. |
Сообщ.
#828
,
|
|
|
Цитата The closure type for a non-generic lambda-expression has a public inline function call operator (13.5.4) whose parameters and return type are described by the lambda-expression’s parameter-declaration-clause and trailing-return-type respectively. For a generic lambda, the closure type has a public inline function call operator member template (14.5.2) whose template-parameter-list consists of one invented type templateparameter for each occurrence of auto in the lambda’s parameter-declaration-clause, in order of appearance. The invented type template-parameter is a parameter pack if the corresponding parameter-declaration declares a function parameter pack (8.3.5). The return type and function parameters of the function call operator template are derived from the lambda-expression’s trailing-return-type and parameter-declarationclause by replacing each occurrence of auto in the decl-specifiers of the parameter-declaration-clause with the name of the corresponding invented template-parameter. Generic-лямбды мало того, что могут принимать аргументы любых типов, так ещё и любое количество аргументов! Интересно, в каком gcc их реализуют? 4.9? Добавлено Туда же: Цитата An array of runtime bound shall only be used as the type of a local object with automatic storage duration. If the size of the array exceeds the size of the memory available for objects with automatic storage duration, the behavior is undefined.100 It is unspecified whether a global allocation function (3.7.4) is invoked to obtain storage for the array. If it is invoked, the corresponding global deallocation function is invoked to release the storage after the lifetime of the array has ended.101 (8.3.4) template <class T> class optional { public: typedef T value_type; // 20.6.4.1, constructors constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; optional(const optional&); optional(optional&&) noexcept(see below ); constexpr optional(const T&); constexpr optional(T&&); template <class... Args> constexpr explicit optional(in_place_t, Args&&...); template <class U, class... Args> constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...); // 20.6.4.2, destructor ~optional(); // 20.6.4.3, assignment optional& operator=(nullopt_t) noexcept; optional& operator=(const optional&); optional& operator=(optional&&) noexcept(see below ); template <class U> optional& operator=(U&&); template <class... Args> void emplace(Args&&...); template <class U, class... Args> void emplace(initializer_list<U>, Args&&...); // 20.6.4.4, swap void swap(optional&) noexcept(see below ); // 20.6.4.5, observers constexpr T const* operator->() const; T* operator->(); constexpr T const& operator*() const; T& operator*(); constexpr explicit operator bool() const noexcept; constexpr T const& value() const; T& value(); template <class U> constexpr T value_or(U&&) const&; template <class U> T value_or(U&&) &&; private: bool init; // exposition only T* val; // exposition only }; |
Сообщ.
#829
,
|
|
|
Цитата Flex Ferrum @ Бинго! init-capture попала в стандарт! А можно вкратце, что это и какая с него практическая польза? |
Сообщ.
#830
,
|
|
|
Ну чё, скоро в std добавят функцию
template<typename ...Args1> template<typename ...Args2> std::tuple<Args1...> solve_current_problem(Args2...); |
Сообщ.
#831
,
|
|
|
Цитата B.V. @ А можно вкратце, что это и какая с него практическая польза? Что-то вроде такого: std::vector<int> nums(10); std::generate(nums.begin(), nums.end(), [n = 0]() mutable {return n++;}); Добавлено Цитата Qraizer @ и программировать станет скучно. Ой, не знаю... Ой, не уверен. |
Сообщ.
#832
,
|
|
|
Цитата Qraizer @ Ну чё, скоро в std добавят функцию template<typename ...Args1> template<typename ...Args2> std::tuple<Args1...> solve_current_problem(Args2...); ну, нечто подобное уже сейчас можно использовать: #include <iostream> #include <tuple> #include <typeinfo> template<typename... Args1, typename... Args2> std::tuple<Args1...> func(Args2&&... args) { return std::make_tuple(args...); } int main() { auto r = func<char, double, int>(3, 3.14, 'c'); std::cout << "0:" << typeid(std::get<0>(r)).name() << std::endl; std::cout << "1:" << typeid(std::get<1>(r)).name() << std::endl; std::cout << "2:" << typeid(std::get<2>(r)).name() << std::endl; } вывод: Цитата 0:c 1:d 2:i |
Сообщ.
#833
,
|
|
|
Цитата niXman @ ну, нечто подобное уже сейчас можно использовать: Ты явно не понял прикола. ЗЫ: А когда LWS перейдёт из режима R/O в полнофункциональный? |
Сообщ.
#834
,
|
|
|
Цитата Flex Ferrum @ Ты явно не понял прикола. ах да, я на название функции не обратил внимания =) Цитата Flex Ferrum @ когда LWS перейдёт из режима R/O в полнофункциональный? надеюсь, к концу следующей недели. |
Сообщ.
#835
,
|
|
|
Во, я всегда говорю - имя функции должно быть не больше 2-3 символов, всё равно никто не читает.
|
Сообщ.
#836
,
|
|
|
А кто-нибудь пробовал прикручивать новый компилятор, например, от Vs2012 к старой (например, Vs2010) студии ? Чтобы она совмещалась с последней версией стандарта. Уж очень мне нравятся все эти сахарные обновляшечки. Без initializer_list вот очень туго живется.
|
Сообщ.
#837
,
|
|
|
Я пробовал прикручивать компилятор от 2010-ой к 2008-ой. Вроде бы получалось. Делал посредством полной замены содержимого директории с компилятором (и директорий с заголовочными файлами и библиотеками). Наверное, и в твоем случае это может получиться.
|
Сообщ.
#838
,
|
|
|
Flex Ferrum
Нет, не получается ... Цитата 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(153,5): error MSB6006: "CL.exe" завершилась с кодом -1073741515. Видимо, разница слишком велика (vs2012 у меня вылетает, как я говорил). |
Сообщ.
#840
,
|
|
|
Цитата MyNameIsIgor @ Ноябрьский CTP компилятор? Судя по, в новой студии наконец-то появятся variadic'и. |