@cella-lang/cpp 0.1.202611152335 → 0.1.202611161932

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGES.md +23 -0
  2. package/cpp.arrays.cell +0 -0
  3. package/cpp.cell +0 -0
  4. package/cpp.classes.cell +0 -0
  5. package/cpp.classrules.cell +0 -0
  6. package/cpp.construction.cell +0 -0
  7. package/cpp.constructs.cell +0 -0
  8. package/cpp.copies.cell +0 -0
  9. package/cpp.exceptions.cell +0 -0
  10. package/cpp.friends.cell +0 -0
  11. package/cpp.inheritance.cell +0 -0
  12. package/cpp.lambdas.cell +0 -0
  13. package/cpp.layouts.cell +0 -0
  14. package/cpp.library.algorithms.cell +0 -0
  15. package/cpp.library.bitsets.cell +0 -0
  16. package/cpp.library.cell +0 -0
  17. package/cpp.library.comparisons.cell +0 -0
  18. package/cpp.library.deques.cell +0 -0
  19. package/cpp.library.iterators.cell +0 -0
  20. package/cpp.library.limits.cell +0 -0
  21. package/cpp.library.lists.cell +0 -0
  22. package/cpp.library.maps.cell +0 -0
  23. package/cpp.library.numerics.cell +0 -0
  24. package/cpp.library.pairs.cell +0 -0
  25. package/cpp.library.queues.cell +0 -0
  26. package/cpp.library.rangeaccess.cell +0 -0
  27. package/cpp.library.sets.cell +0 -0
  28. package/cpp.library.stacks.cell +0 -0
  29. package/cpp.library.streamiterators.cell +0 -0
  30. package/cpp.library.strings.cell +0 -0
  31. package/cpp.library.trees.cell +0 -0
  32. package/cpp.library.tuples.cell +0 -0
  33. package/cpp.library.unorderedmaps.cell +0 -0
  34. package/cpp.library.vectors.cell +0 -0
  35. package/cpp.memberpointers.cell +0 -0
  36. package/cpp.names.cell +0 -0
  37. package/cpp.objects.cell +0 -0
  38. package/cpp.operators.cell +0 -0
  39. package/cpp.overloading.cell +0 -0
  40. package/cpp.polymorphism.cell +0 -0
  41. package/cpp.primitives.cell +0 -0
  42. package/cpp.ranges.cell +0 -0
  43. package/cpp.references.cell +0 -0
  44. package/cpp.runtimetypes.cell +0 -0
  45. package/cpp.standardexceptions.cell +0 -0
  46. package/cpp.standardfunctions.cell +0 -0
  47. package/cpp.standardnames.cell +0 -0
  48. package/cpp.staticmembers.cell +0 -0
  49. package/cpp.streams.cell +0 -0
  50. package/cpp.templates.cell +0 -0
  51. package/cpp.userconversions.cell +0 -0
  52. package/index.json +237 -150
  53. package/package.json +7 -6
package/CHANGES.md CHANGED
@@ -5,6 +5,29 @@
5
5
 
6
6
  ## 未發佈
7
7
 
8
+ - **`<iterator>` 的範圍存取:`std::begin`、`end`、`cbegin`、`cend`、`rbegin`、`rend`、`crbegin`、`crend`、`size`、`empty`、`data`**
9
+ ([iterator.range]、[iterator.container]):之前這些自由函式判 unknown(不支援)。現在照 libc++ 18:容器的版本呼叫同名的成員
10
+ (`vector`、`string`、`deque`、`set`、`map` 等模型有的容器;const 的容器拿到 const 迭代器),內建陣列 `T a[N]` 的版本是指標
11
+ (`begin` 是 `a`、`end` 是 `a + N`、`rbegin` 是包著 `a + N` 的反向迭代器)、`size` 是 `N`、`empty` 是 false。寫成 `using namespace std;` 或命名空間層級的 `using std::begin;` 之後不加 `std::` 的呼叫也可以。用它們越界照舊
12
+ 判 reject(`*std::end(a)`、空的 vector 的 `*std::begin(v)`)。`std::ssize` 是 C++20 的,C++17 不宣告,沒有提供。
13
+ 函式庫的新標頭 `cpp.library.rangeaccess`(`Library.rangeAccess`;只有呼叫這些自由函式的程式才帶上它,成員 `v.begin()` 不會)。
14
+ 模型配合的改動:
15
+ - 函式樣板的回傳或參數型別寫成型別參數的成員型別(`typename C::iterator`)時,代換出來的型別沒有這個成員(陣列、指標、純量,或
16
+ 程式的類別沒有這個 typedef 或巢狀類別)是推導失敗,那個樣板不列入候選([temp.deduct]p8,SFINAE);之前轉換工具把它寫成
17
+ 名叫 `C::iterator` 的類別,用到判 reject(unknown type)。const 類別的成員型別是類別的(`C` 推導成 `const vector<int>`)。
18
+ - 陣列的參考:參數 `int (&a)[3]`、樣板參數 `const T (&)[N]`(從引數推導出 `N`)、區塊裡的 `int (&r)[3] = b;`。之前轉換工具不認得
19
+ `int (&)[3]`,整支程式轉不出來。
20
+ - 容器補上 libc++ 有的成員型別:`vector`、`string` 的 `pointer`、`const_pointer`,`set`、`multiset` 的 `const_reverse_iterator`,
21
+ `initializer_list` 的 `iterator`、`const_iterator`、`size_type`。
22
+ 新的內部名字:`Templates.signatureFits`、`Templates.declaresType`、`Templates.withoutMembers`、`Templates.boundLength`、
23
+ `cfamily.TypeSyntax.isArray`。函式庫模組 `cpp.library.vectors`、`strings`、`sets`、`lists` 重新產生(雜湊改變)。
24
+ 測試:`tests/cases/range_access/`(11 支,在 VM 上跑;改前 9 支 unknown、`using_declarations.cpp` 判 reject(use of undeclared
25
+ identifier 'size',錯的 reject)、`array_references.cpp` 轉不出來;改後 11 支和 clang 的結果一致)。
26
+ 沒做:區塊裡的 `using std::begin;`(語意樹沒有區塊層級的 using 宣告);程式自己也定義同名的函式時,`using std::begin;` 帶進來的
27
+ 和自己的合成一個多載集合(照舊只看自己的,`begin(v)` 判 reject,改前就是如此);對使用者命名空間裡的函式做引數相依查找
28
+ (`geo::Line l; begin(l)` 找 `geo::begin`,照舊判 reject,改前就是如此);陣列的 `std::size(a)` 用在常數運算式(陣列長度、
29
+ `static_assert`)照舊不判定(模型不知道哪些函式是 constexpr)。
30
+
8
31
  - **有引數的 constexpr 建構子:用常數建構的全域物件是常數初始化**([basic.start.static]p2、[expr.const]p2、[dcl.constexpr]p3):
9
32
  之前 `struct P { int v; constexpr P(int a) : v(a) {} }; P p(3);` 的 `p` 在原來的位置建構,寫在前面的動態初始化讀它判 reject,clang
10
33
  讀到 3。現在全域物件用 `P p(3)`、`P p = P(3)`、`P p{3}` 建構、引數只由字面常數與寫在前面可以用在常數運算式裡的 const 整數組成,
package/cpp.arrays.cell CHANGED
Binary file
package/cpp.cell CHANGED
Binary file
package/cpp.classes.cell CHANGED
Binary file
Binary file
Binary file
Binary file
package/cpp.copies.cell CHANGED
Binary file
Binary file
package/cpp.friends.cell CHANGED
Binary file
Binary file
package/cpp.lambdas.cell CHANGED
Binary file
package/cpp.layouts.cell CHANGED
Binary file
Binary file
Binary file
package/cpp.library.cell CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/cpp.names.cell CHANGED
Binary file
package/cpp.objects.cell CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
package/cpp.ranges.cell CHANGED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/cpp.streams.cell CHANGED
Binary file
Binary file
Binary file