File tree Expand file tree Collapse file tree 3 files changed +69
-0
lines changed
Expand file tree Collapse file tree 3 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ namespace Platform . Ranges
2+ {
3+ public struct Range < T >
4+ {
5+ public T Minimum ;
6+ public T Maximum ;
7+
8+ public override int GetHashCode ( )
9+ {
10+ return { Minimum , Maximum } . GetHashCode ( ) ;
11+ }
12+ }
13+ }
Original file line number Diff line number Diff line change 1+ using System ;
2+ using Platform . RegularExpressions . Transformer . CSharpToCpp ;
3+
4+ class Program
5+ {
6+ static void Main ( )
7+ {
8+ var transformer = new CSharpToCppTransformer ( ) ;
9+
10+ string input = @"
11+ namespace Platform.Ranges
12+ {
13+ public struct Range<T>
14+ {
15+ public T Minimum;
16+ public T Maximum;
17+
18+ public override int GetHashCode()
19+ {
20+ return {Minimum, Maximum}.GetHashCode();
21+ }
22+ }
23+ }" ;
24+
25+ string result = transformer . Transform ( input ) ;
26+ Console . WriteLine ( "===== TRANSFORMED OUTPUT =====" ) ;
27+ Console . WriteLine ( result ) ;
28+
29+ // Check if we have the new safe specialization syntax
30+ if ( result . Contains ( "template <typename T>" ) && result . Contains ( "struct std::hash<" ) )
31+ {
32+ Console . WriteLine ( "\n ✅ SUCCESS: Safe specialization pattern detected!" ) ;
33+ if ( ! result . Contains ( "namespace std\n {" ) )
34+ {
35+ Console . WriteLine ( "✅ SUCCESS: No unsafe namespace std usage detected!" ) ;
36+ }
37+ }
38+ else
39+ {
40+ Console . WriteLine ( "\n ❌ FAILURE: Safe specialization pattern not found!" ) ;
41+ }
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ namespace Platform . Ranges
2+ {
3+ public struct Range < T >
4+ {
5+ public T Minimum { get ; set ; }
6+ public T Maximum { get ; set ; }
7+
8+ public override int GetHashCode ( )
9+ {
10+ return { Minimum , Maximum } . GetHashCode ( ) ;
11+ }
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments