mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 03:17:53 +00:00
Fix ArgList::operator[]
This commit is contained in:
parent
b2bd63d2d9
commit
a9da3d3852
8
format.h
8
format.h
@ -897,13 +897,15 @@ class ArgList {
|
||||
*/
|
||||
internal::Arg operator[](unsigned index) const {
|
||||
using internal::Arg;
|
||||
if (index >= MAX_ARGS)
|
||||
return Arg();
|
||||
Arg arg;
|
||||
if (index >= MAX_ARGS) {
|
||||
arg.type = Arg::NONE;
|
||||
return arg;
|
||||
}
|
||||
unsigned shift = index * 4;
|
||||
uint64_t mask = 0xf;
|
||||
Arg::Type type =
|
||||
static_cast<Arg::Type>((types_ & (mask << shift)) >> shift);
|
||||
Arg arg;
|
||||
arg.type = type;
|
||||
if (type != Arg::NONE) {
|
||||
internal::Value &value = arg;
|
||||
|
Loading…
Reference in New Issue
Block a user