Talk:cpp/io/ios base/xalloc
In the description: Returns a unique (program-wide) index value that can be used to access one long and one void* elements in the private storage of std::ios_base by calling iword() and pword().
Maybe it should be:
Returns a unique index value "operating system process-wide" / "address space-wide" on shared "static storage" ...
I can imagine "program" comprising one "shared object" / "DLL" or more "shared objects" / "DLLS" operating on one "address space" ? "program" is too general term ?
Thank you
vlakov--193.58.194.195 20:31, 4 June 2014 (PDT)
- "program" is a specific term, it's the result of translation. I suppose this can say 'static' instead. --Cubbi (talk) 21:32, 4 June 2014 (PDT)
[edit] Multiple indices in example
I don't understand why, in the example, every template instance of mystream
has its own index. Isn't the whole point of xalloc()
to return a program-wide value, as mentioned in the first paragraph? Why would you use different indices here? The only reason I can think of is multiple inheritance, but I don't think that would be a good idea anyway (mixing different character or character traits types). Electrolisk (talk) 04:52, 9 March 2020 (PDT)
- not "every template instance", but "every template specialization". The example demonstrates how to get every mystream<char> use one index and every mystream<wchar_t> use another. It's not strictly needed for the specific use demonstrated in the example (which doesn't distinguish between char and wchar_t mystreams), but it's a typical pattern for this construct. --Cubbi (talk) 06:00, 9 March 2020 (PDT)