Created
November 12, 2024 23:29
-
-
Save ufcpp/dbfd9926b2e1721c280088434f838ac1 to your computer and use it in GitHub Desktop.
VS 17.13 preview 1 に First-class Span 入ってる (LangVersion preview)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ } | |
string[] a = []; | |
ReadOnlySpan<object> a2 = a; // C# 13 でも OK | |
Span<string> s = []; | |
ReadOnlySpan<object> s2 = s; // これは 13 だとエラー。 | |
C.M(new object[1]); // これは 13 だと ambiguous。preview だと Span っぽい。ReadOnlySpan にするみたいな話はみた。 | |
new int[1].Ex(); // 13 だと拡張メソッドでの T[] → ROS<T> 変換は見てくれない。 | |
static class C | |
{ | |
public static void M(ReadOnlySpan<object> s) { } | |
public static void M(Span<object> s) { } | |
public static void M(IEnumerable<object> s) { } | |
public static void Ex(this ReadOnlySpan<int> _) { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment