add support for formatting pointers
This commit is contained in:
parent
bc2bb5e635
commit
2d21a894cd
|
@ -276,7 +276,7 @@ namespace detail {
|
|||
int pfxlen = 0;
|
||||
if (fl->flags & FMT_FLAG_HASH && spec != 'd') {
|
||||
pfx = octa::detail::fmt_intpfx[spec >= 'a'][specn - 3];
|
||||
pfxlen = strlen(pfx);
|
||||
pfxlen = !!pfx[1] + 1;
|
||||
r += pfxlen;
|
||||
}
|
||||
|
||||
|
@ -400,6 +400,16 @@ namespace detail {
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* pointer value */
|
||||
template<typename R, typename T>
|
||||
octa::Ptrdiff write(R &writer, T *val) {
|
||||
if (this->spec == 's') {
|
||||
this->spec = 'x';
|
||||
this->flags |= FMT_FLAG_HASH;
|
||||
}
|
||||
return write(writer, octa::Size(val));
|
||||
}
|
||||
|
||||
/* generic value */
|
||||
template<typename R, typename T>
|
||||
octa::Ptrdiff write(R &writer, const T &val, octa::EnableIf<
|
||||
|
|
Loading…
Reference in a new issue