You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest Visual Studio compiler 17.5 has standard library modules.
I am wondering if you want to support using the standard library via a module as well as old style includes.
I have a local branch where I can include all the type_safe header files in a test program using "import std;
If you are interested in this I can push a draft PR for you to look at. I tried to make the minimal amount of changes and to make sure that the default behaviour is everything works as is.
The main changes are
Use a macro in all the headers to choose whether to import or include. Obvisouly the default is to include. For example
In theory you should be able to mix import and old style headers but the MS compiler does not support that yet and may not for a while see microsoft/STL#3195 for STLs comment about this. In any case I think it's a good idead to macro out the old stuff.
2) Fix a couple of cases where the headers assumed things like int8_t were in the global namespace. Note that this cou;d be fixed by using std.compat but I think it's good to not really on global namespace pollution
3) There appears to be a compiler bug that is trigger by including the type_safe header using /std:c++latest switch. I have a MS dev community issues filed for it https://developercommunity.visualstudio.com/t/VS-22-174-templated-constructor-paramet/10202157. I put a couple of fixes in the code guarded by macors so the exiting code is the default.
4) The test program is a new project and is off by default in CMake
option(TYPE_SAFE_IMPORT_STD_MODULE "Build using the standard library modules rather than #include" OFF)
if(TYPE_SAFE_IMPORT_STD_MODULE)
add_subdirectory(test_std_module/)
endif()
I believe this includes all the changes needed to make the type_headers work with std module. A furhter step would be to get all the test programs and examples to build as well. I could do this as a follow up PR or include it in this one although that will obviously make the diff bigger.
Anyway let me know how you feel or if you have any suggestions.
The text was updated successfully, but these errors were encountered:
BTW including the type_safe headers with /std::latest does give a few warnings
'std::aligned_storage<4,4>': warning STL4034: std::aligned_storage and std::aligned_storage_t are deprecated in C++23. Prefer alignas(T) std::byte t_buff[sizeof(T)].
Sounds good. Please split bugfixes and compiler workaround into separate PRs.
A furhter step would be to get all the test programs and examples to build as well. I could do this as a follow up PR or include it in this one although that will obviously make the diff bigger.
Let's focus on things affecting end users first.
BTW including the type_safe headers with /std::latest does give a few warnings
Right, these should be replaced by alignas + char array. Can you do a separate PR for that?
The latest Visual Studio compiler 17.5 has standard library modules.
I am wondering if you want to support using the standard library via a module as well as old style includes.
I have a local branch where I can include all the type_safe header files in a test program using "import std;
If you are interested in this I can push a draft PR for you to look at. I tried to make the minimal amount of changes and to make sure that the default behaviour is everything works as is.
The main changes are
becomes
In theory you should be able to mix import and old style headers but the MS compiler does not support that yet and may not for a while see microsoft/STL#3195 for STLs comment about this. In any case I think it's a good idead to macro out the old stuff.
2) Fix a couple of cases where the headers assumed things like int8_t were in the global namespace. Note that this cou;d be fixed by using std.compat but I think it's good to not really on global namespace pollution
3) There appears to be a compiler bug that is trigger by including the type_safe header using /std:c++latest switch. I have a MS dev community issues filed for it https://developercommunity.visualstudio.com/t/VS-22-174-templated-constructor-paramet/10202157. I put a couple of fixes in the code guarded by macors so the exiting code is the default.
4) The test program is a new project and is off by default in CMake
I believe this includes all the changes needed to make the type_headers work with std module. A furhter step would be to get all the test programs and examples to build as well. I could do this as a follow up PR or include it in this one although that will obviously make the diff bigger.
Anyway let me know how you feel or if you have any suggestions.
The text was updated successfully, but these errors were encountered: