fundamentals-ts

How could std::experimental::source_location be implemented?

删除回忆录丶 提交于 2020-08-24 06:03:06
问题 C++ Extensions for Library Fundamentals, Version 2 (N4564) introduces the type std::experimental::source_location. § 14.1.2 [reflection.src_loc.creation] says: static constexpr source_location current() noexcept; Returns: When invoked by a function call (C++14 § 5.2.2) whose postfix-expression is a (possibly parenthesized) id-expression naming current , returns a source_location with an implementation-defined value. The value should be affected by #line (C++14 § 16.4) in the same manner as

string_view behaviour when passing temporary std::string

社会主义新天地 提交于 2019-12-04 00:24:35
问题 I just ran into some misunderstanding: at least in libc++ implementation std::experimental::string_view has the following concise implementation: template <class _CharT, class _Traits....> class basic_string_view { public: typedef _CharT value_type; ... template <class _Allocator> basic_string_view(const basic_string<_CharT, _Traits, _Allocator>& str): __data(str.data()), __size(str.size()) { } private: const value_type* __data; size_type __size; }; Does this implementation imply that if we

What is string_view?

眉间皱痕 提交于 2019-11-27 02:59:42
string_view was a proposed feature within the C++ Library Fundamentals TS( N3921 ) added to C++17 As far as i understand it is a type that represent some kind of string "concept" that is a view of any type of container that could store something viewable as a string. Is this right ? Should the canonical const std::string& parameter type become string_view ? Is there another important point about string_view to take into consideration ? The purpose of any and all kinds of "string reference" and "array reference" proposals is to avoid copying data which is already owned somewhere else and of

What is string_view?

本小妞迷上赌 提交于 2019-11-26 08:49:28
问题 string_view was a proposed feature within the C++ Library Fundamentals TS(N3921) added to C++17 As far as i understand it is a type that represent some kind of string \"concept\" that is a view of any type of container that could store something viewable as a string. Is this right ? Should the canonical const std::string& parameter type become string_view ? Is there another important point about string_view to take into consideration ? 回答1: The purpose of any and all kinds of "string