54 lines
1.8 KiB
Markdown
54 lines
1.8 KiB
Markdown
[format.args]
|
|
|
|
# 28 Text processing library [[text]](./#text)
|
|
|
|
## 28.5 Formatting [[format]](format#args)
|
|
|
|
### 28.5.8 Arguments [[format.arguments]](format.arguments#format.args)
|
|
|
|
#### 28.5.8.3 Class template basic_format_args [format.args]
|
|
|
|
namespace std {template<class Context>class basic_format_args { size_t size_; // *exposition only*const basic_format_arg<Context>* data_; // *exposition only*public:template<class... Args> basic_format_args(const *format-arg-store*<Context, Args...>& store) noexcept;
|
|
|
|
basic_format_arg<Context> get(size_t i) const noexcept; }; template<class Context, class... Args> basic_format_args(*format-arg-store*<Context, Args...>) -> basic_format_args<Context>;}
|
|
|
|
[1](#1)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8717)
|
|
|
|
An instance of basic_format_args provides access to formatting
|
|
arguments[.](#1.sentence-1)
|
|
|
|
Implementations should
|
|
optimize the representation of basic_format_args for a small number of formatting arguments[.](#1.sentence-2)
|
|
|
|
[*Note [1](#note-1)*:
|
|
|
|
For example, by storing indices of type alternatives separately from values
|
|
and packing the former[.](#1.sentence-3)
|
|
|
|
â *end note*]
|
|
|
|
[ð](#lib:basic_format_args,constructor)
|
|
|
|
`template<class... Args>
|
|
basic_format_args(const format-arg-store<Context, Args...>& store) noexcept;
|
|
`
|
|
|
|
[2](#2)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8735)
|
|
|
|
*Effects*: Initializessize_ with sizeof...(Args) anddata_ with store.args.data()[.](#2.sentence-1)
|
|
|
|
[ð](#lib:get,basic_format_args)
|
|
|
|
`basic_format_arg<Context> get(size_t i) const noexcept;
|
|
`
|
|
|
|
[3](#3)
|
|
|
|
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L8748)
|
|
|
|
*Returns*: i < size_ ? data_[i] : basic_format_arg<Context>()[.](#3.sentence-1)
|