Skip to content

Commit d86f933

Browse files
committed
fixes compilation problems with c++ modules in MSVC (#324)
1 parent 68629cc commit d86f933

File tree

7 files changed

+222
-218
lines changed

7 files changed

+222
-218
lines changed

ctre.cppm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
module;
22

3+
#ifdef _MSVC_LANG
4+
#pragma warning( disable : 5202 )
5+
#endif
6+
37
import std;
48

59
export module ctre;

include/ctll/fixed_string.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <cstdint>
1010
#endif
1111

12+
#include "utilities.hpp"
13+
1214
namespace ctll {
1315

1416
struct length_value_t {
@@ -43,7 +45,7 @@ struct construct_from_pointer_t { };
4345

4446
constexpr auto construct_from_pointer = construct_from_pointer_t{};
4547

46-
template <size_t N> struct fixed_string {
48+
CTLL_EXPORT template <size_t N> struct fixed_string {
4749
char32_t content[N] = {};
4850
size_t real_size{0};
4951
bool correct_flag{true};

include/ctll/utilities.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
#endif
77

88
#ifdef CTLL_IN_A_MODULE
9-
#define CTLL_EXPORT
10-
#else
119
#define CTLL_EXPORT export
10+
#else
11+
#define CTLL_EXPORT
1212
#endif
1313

1414
#if defined __cpp_nontype_template_parameter_class

include/ctre/find_captures.hpp

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,120 +8,118 @@
88

99
namespace ctre {
1010

11-
template <typename Pattern> constexpr auto find_captures(Pattern) noexcept {
11+
CTRE_EXPORT template <typename Pattern> constexpr auto find_captures(Pattern) noexcept {
1212
return find_captures(ctll::list<Pattern>(), ctll::list<>());
1313
}
1414

15-
template <typename... Output> constexpr auto find_captures(ctll::list<>, ctll::list<Output...> output) noexcept {
15+
CTRE_EXPORT template <typename... Output> constexpr auto find_captures(ctll::list<>, ctll::list<Output...> output) noexcept {
1616
return output;
1717
}
1818

1919

2020

21-
template <auto... String, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<string<String...>, Tail...>, Output output) noexcept {
21+
CTRE_EXPORT template <auto... String, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<string<String...>, Tail...>, Output output) noexcept {
2222
return find_captures(ctll::list<Tail...>(), output);
2323
}
2424

25-
template <typename... Options, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<select<Options...>, Tail...>, Output output) noexcept {
25+
CTRE_EXPORT template <typename... Options, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<select<Options...>, Tail...>, Output output) noexcept {
2626
return find_captures(ctll::list<Options..., Tail...>(), output);
2727
}
2828

29-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<optional<Content...>, Tail...>, Output output) noexcept {
29+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<optional<Content...>, Tail...>, Output output) noexcept {
3030
return find_captures(ctll::list<Content..., Tail...>(), output);
3131
}
3232

33-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_optional<Content...>, Tail...>, Output output) noexcept {
33+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_optional<Content...>, Tail...>, Output output) noexcept {
3434
return find_captures(ctll::list<Content..., Tail...>(), output);
3535
}
3636

37-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<sequence<Content...>, Tail...>, Output output) noexcept {
37+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<sequence<Content...>, Tail...>, Output output) noexcept {
3838
return find_captures(ctll::list<Content..., Tail...>(), output);
3939
}
4040

41-
template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<empty, Tail...>, Output output) noexcept {
41+
CTRE_EXPORT template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<empty, Tail...>, Output output) noexcept {
4242
return find_captures(ctll::list<Tail...>(), output);
4343
}
4444

4545

46-
template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<assert_subject_begin, Tail...>, Output output) noexcept {
46+
CTRE_EXPORT template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<assert_subject_begin, Tail...>, Output output) noexcept {
4747
return find_captures(ctll::list<Tail...>(), output);
4848
}
4949

5050

51-
template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<assert_subject_end, Tail...>, Output output) noexcept {
51+
CTRE_EXPORT template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<assert_subject_end, Tail...>, Output output) noexcept {
5252
return find_captures(ctll::list<Tail...>(), output);
5353
}
5454

5555

5656
// , typename = std::enable_if_t<(MatchesCharacter<CharacterLike>::template value<char>)
57-
template <typename CharacterLike, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<CharacterLike, Tail...>, Output output) noexcept {
57+
CTRE_EXPORT template <typename CharacterLike, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<CharacterLike, Tail...>, Output output) noexcept {
5858
return find_captures(ctll::list<Tail...>(), output);
5959
}
6060

6161

62-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<plus<Content...>, Tail...>, Output output) noexcept {
62+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<plus<Content...>, Tail...>, Output output) noexcept {
6363
return find_captures(ctll::list<Content..., Tail...>(), output);
6464
}
6565

66-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<star<Content...>, Tail...>, Output output) noexcept {
66+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<star<Content...>, Tail...>, Output output) noexcept {
6767
return find_captures(ctll::list<Content..., Tail...>(), output);
6868
}
6969

70-
template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<repeat<A,B,Content...>, Tail...>, Output output) noexcept {
70+
CTRE_EXPORT template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<repeat<A,B,Content...>, Tail...>, Output output) noexcept {
7171
return find_captures(ctll::list<Content..., Tail...>(), output);
7272
}
7373

7474

75-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_plus<Content...>, Tail...>, Output output) noexcept {
75+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_plus<Content...>, Tail...>, Output output) noexcept {
7676
return find_captures(ctll::list<Content..., Tail...>(), output);
7777
}
7878

79-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_star<Content...>, Tail...>, Output output) noexcept {
79+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_star<Content...>, Tail...>, Output output) noexcept {
8080
return find_captures(ctll::list<Content..., Tail...>(), output);
8181
}
8282

83-
template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_repeat<A,B,Content...>, Tail...>, Output output) noexcept {
83+
CTRE_EXPORT template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_repeat<A,B,Content...>, Tail...>, Output output) noexcept {
8484
return find_captures(ctll::list<Content..., Tail...>(), output);
8585
}
8686

8787

88-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_plus<Content...>, Tail...>, Output output) noexcept {
88+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_plus<Content...>, Tail...>, Output output) noexcept {
8989
return find_captures(ctll::list<Content..., Tail...>(), output);
9090
}
9191

92-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_star<Content...>, Tail...>, Output output) noexcept {
92+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_star<Content...>, Tail...>, Output output) noexcept {
9393
return find_captures(ctll::list<Content..., Tail...>(), output);
9494
}
9595

96-
template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_repeat<A,B,Content...>, Tail...>, Output output) noexcept {
96+
CTRE_EXPORT template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_repeat<A,B,Content...>, Tail...>, Output output) noexcept {
9797
return find_captures(ctll::list<Content..., Tail...>(), output);
9898
}
9999

100100

101101

102-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lookahead_positive<Content...>, Tail...>, Output output) noexcept {
102+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lookahead_positive<Content...>, Tail...>, Output output) noexcept {
103103
return find_captures(ctll::list<Content..., Tail...>(), output);
104104
}
105105

106106

107-
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lookahead_negative<Content...>, Tail...>, Output output) noexcept {
107+
CTRE_EXPORT template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lookahead_negative<Content...>, Tail...>, Output output) noexcept {
108108
return find_captures(ctll::list<Content..., Tail...>(), output);
109109
}
110110

111111

112112

113113

114-
template <size_t Id, typename... Content, typename... Tail, typename... Output> constexpr auto find_captures(ctll::list<capture<Id,Content...>, Tail...>, ctll::list<Output...>) noexcept {
114+
CTRE_EXPORT template <size_t Id, typename... Content, typename... Tail, typename... Output> constexpr auto find_captures(ctll::list<capture<Id,Content...>, Tail...>, ctll::list<Output...>) noexcept {
115115
return find_captures(ctll::list<Content..., Tail...>(), ctll::list<Output..., captured_content<Id>>());
116116
}
117117

118118

119-
template <size_t Id, typename Name, typename... Content, typename... Tail, typename... Output> constexpr auto find_captures(ctll::list<capture_with_name<Id,Name,Content...>, Tail...>, ctll::list<Output...>) noexcept {
119+
CTRE_EXPORT template <size_t Id, typename Name, typename... Content, typename... Tail, typename... Output> constexpr auto find_captures(ctll::list<capture_with_name<Id,Name,Content...>, Tail...>, ctll::list<Output...>) noexcept {
120120
return find_captures(ctll::list<Content..., Tail...>(), ctll::list<Output..., captured_content<Id, Name>>());
121121
}
122122

123-
124-
125123
}
126124

127125
#endif

include/ctre/wrapper.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct iterator_method {
156156
}
157157
};
158158

159-
template <typename RE, typename Method, typename Modifier> struct regular_expression {
159+
CTRE_EXPORT template <typename RE, typename Method, typename Modifier> struct regular_expression {
160160
constexpr CTRE_FORCE_INLINE regular_expression() noexcept { }
161161
constexpr CTRE_FORCE_INLINE regular_expression(RE) noexcept { }
162162

0 commit comments

Comments
 (0)