I have a basic question about the arithmetic inserters; § 27.7.3.6.2/1 [ostream.inserters.arithmetic]:
When val is of type bool, long, unsigned long, long long, unsigned long long, double, long double, or const void*, the formatting conversion occurs as if it performed the following code fragment:
bool failed = use_facet< num_put<charT,ostreambuf_iterator<charT,traits> > > (getloc()).put(*this, *this, fill(), val).failed()
The question is what exact function performs the conversion from a pointer to type to, as Matt McNabb corrected, const void*
? For instance:
int *ip = new int(1);
std::cout << ip; //0xaa33fa67
I'm not concerned in an implementation details, I just would like to know what function produces arithmetic result from the pointer. Is it put
in the example above?
const void *
, notlong
– Distributaryconst void *
happens when the pointer is passed tooperator<<(const void *)
. – Benoit