Skip to content

Commit 0a5d1f6

Browse files
committed
Try for better std hygiene
1 parent f4073d3 commit 0a5d1f6

6 files changed

Lines changed: 16 additions & 14 deletions

File tree

strings/base_collections_map.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ WINRT_EXPORT namespace winrt
116116
}
117117
}
118118

119-
WINRT_EXPORT namespace std
119+
WINRT_IMPL_STD_EXPORT namespace std
120120
{
121121
template<typename K, typename V>
122122
struct tuple_size<winrt::Windows::Foundation::Collections::IKeyValuePair<K, V>>

strings/base_coroutine_foundation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ WINRT_EXPORT namespace winrt::impl
704704
};
705705
}
706706

707-
WINRT_EXPORT namespace std
707+
WINRT_IMPL_STD_EXPORT namespace std
708708
{
709709
template <typename... Args>
710710
struct coroutine_traits<winrt::Windows::Foundation::IAsyncAction, Args...>

strings/base_coroutine_threadpool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ WINRT_EXPORT namespace winrt
671671
struct fire_and_forget {};
672672
}
673673

674-
WINRT_EXPORT namespace std
674+
WINRT_IMPL_STD_EXPORT namespace std
675675
{
676676
template <typename... Args>
677677
struct coroutine_traits<winrt::fire_and_forget, Args...>

strings/base_std_hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ WINRT_EXPORT namespace winrt::impl
3232
};
3333
}
3434

35-
WINRT_EXPORT namespace std
35+
WINRT_IMPL_STD_EXPORT namespace std
3636
{
3737
template<> struct hash<winrt::hstring>
3838
{

test/nuget/TestModuleApp/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "pch.h"
22

33
#define WINRT_IMPORT_MODULE
4+
import std;
45
import winrt.Windows.Foundation;
56
import winrt.Windows.UI.Xaml;
67

@@ -17,10 +18,10 @@ int main()
1718
// Test ModuleTestHelper
1819
auto helper = TestModuleApp::ModuleTestHelper();
1920
auto uri = helper.CreateUri(L"https://example.com");
20-
printf("URI: %ls\n", uri.AbsoluteUri().c_str());
21+
std::printf("URI: %ls\n", uri.AbsoluteUri().c_str());
2122

2223
auto str = helper.GetStringAsync().get();
23-
printf("Async: %ls\n", str.c_str());
24+
std::printf("Async: %ls\n", str.c_str());
2425

2526
// Test CustomDependencyObject (inherits from DependencyObject)
2627
// Note: DependencyObject requires XAML runtime, which isn't available in a console app.
@@ -29,13 +30,13 @@ int main()
2930
{
3031
auto obj = winrt::make<TestModuleApp::implementation::CustomDependencyObject>();
3132
obj.Name(L"test");
32-
printf("Name: %ls\n", obj.Name().c_str());
33+
std::printf("Name: %ls\n", obj.Name().c_str());
3334
}
3435
catch (winrt::hresult_error const& e)
3536
{
36-
printf("CustomDependencyObject: expected runtime error (no XAML host): %ls\n", e.message().c_str());
37+
std::printf("CustomDependencyObject: expected runtime error (no XAML host): %ls\n", e.message().c_str());
3738
}
3839

39-
printf("All module tests passed.\n");
40+
std::printf("All module tests passed.\n");
4041
return 0;
4142
}

test/nuget/TestModuleConsumerApp/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "pch.h"
22

3+
import std;
34
import winrt.Windows.Foundation;
45
import winrt.TestModuleComponent1;
56
import winrt.TestModuleComponent2;
@@ -13,19 +14,19 @@ int main()
1314

1415
// Platform types from pre-built modules
1516
Uri uri(L"https://example.com/consumer");
16-
printf("URI: %ls\n", uri.AbsoluteUri().c_str());
17+
std::printf("URI: %ls\n", uri.AbsoluteUri().c_str());
1718

1819
// Component1
1920
auto greeter = TestModuleComponent1::Greeter(L"Modules");
20-
printf("Greet: %ls\n", greeter.Greet().c_str());
21-
printf("Homepage: %ls\n", greeter.Homepage().AbsoluteUri().c_str());
21+
std::printf("Greet: %ls\n", greeter.Greet().c_str());
22+
std::printf("Homepage: %ls\n", greeter.Homepage().AbsoluteUri().c_str());
2223

2324
// Component2 (depends on Component1)
2425
auto group = TestModuleComponent2::GreeterGroup();
2526
group.Add(TestModuleComponent1::Greeter(L"Alice"));
2627
group.Add(TestModuleComponent1::Greeter(L"Bob"));
27-
printf("GreetAll: %ls\n", group.GreetAll().c_str());
28+
std::printf("GreetAll: %ls\n", group.GreetAll().c_str());
2829

29-
printf("All consumer tests passed.\n");
30+
std::printf("All consumer tests passed.\n");
3031
return 0;
3132
}

0 commit comments

Comments
 (0)