[STL]
std::addressof() is in both 2013 and 2015 Preview. I recently found a
minor issue, which I'm fixing for 2015 RTM - it didn't properly handle
functions.
[Peter Dimov]
I think that this is the reason we're defining the macro for it.
I could have fixed this years ago if somebody had told me.
We probably also need to test it with std::nullptr_t, as this is another
corner case IIRC.
Works in 2013 (also with my new implementation):
C:\Temp>type meow.cpp
#include
#include <cstddef>
#include <iostream>
#include <utility>
using namespace std;
int main() {
printf("%02d.%02d.%05d.%02d\n", _MSC_VER / 100, _MSC_VER % 100, _MSC_FULL_VER % 100000, _MSC_BUILD);
nullptr_t np1;
nullptr_t np2;
nullptr_t * p1 = addressof(np1);
nullptr_t * p2 = addressof(np2);
cout << boolalpha;
cout << (p1 == &np1) << endl;
cout << (p2 == &np2) << endl;
cout << (p1 != p2) << endl;
}
C:\Temp>cl /EHsc /nologo /W4 /MTd meow.cpp && meow
meow.cpp
18.00.31101.00
true
true
true
STL