Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
same _Storage_type for const string and string
Co-authored-by: S. B. Tam <[email protected]>
  • Loading branch information
fsb4000 and cpplearner committed Jun 8, 2022
commit 8caf0bd0e1c1e0825a124a6d41602f3e7347d51b
2 changes: 1 addition & 1 deletion stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ struct _Format_arg_traits {
-> basic_string_view<_Char_type>; // not defined

template <class _Traits, class _Alloc>
static auto _Phony_basic_format_arg_constructor(const basic_string<_Char_type, _Traits, _Alloc>&)
static auto _Phony_basic_format_arg_constructor(basic_string<_Char_type, _Traits, _Alloc>)
Comment thread
StephanTLavavej marked this conversation as resolved.
Comment thread
StephanTLavavej marked this conversation as resolved.
Comment thread
StephanTLavavej marked this conversation as resolved.
-> basic_string_view<_Char_type>; // not defined

static auto _Phony_basic_format_arg_constructor(nullptr_t) -> const void*; // not defined
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P0645R10_text_formatting_args/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstdint>
#include <format>
#include <memory>
#include <string>
#include <string_view>
#include <type_traits>
#include <variant>
Expand Down Expand Up @@ -212,6 +213,9 @@ void test_format_arg_store() {
static_assert(sizeof(_Format_arg_index) == sizeof(size_t));
static_assert(is_same_v<_Format_arg_traits<format_context>::_Storage_type<void*>, const void*>);

static_assert(is_same_v<_Format_arg_traits<format_context>::_Storage_type<string>, string_view>);
static_assert(is_same_v<_Format_arg_traits<format_context>::_Storage_type<const string>, string_view>);

template <class Context>
void test_visit_monostate() {
assert(visit_format_arg(visitor<Context>, basic_format_arg<Context>()) == Arg_type::none);
Expand Down