[libcxx-commits] [PATCH] D153200: [libc++] "Implements" new SI prefixis.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 17 06:53:06 PDT 2023


Mordante created this revision.
Herald added a subscriber: arichardson.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Like yocto, zepto, zetta, and yotta. The new prefixes quecto, ronto,
ronna, and quetta can't be implemented in a intmax_t. So their
implementation does nothing.

Implements

- P2734R0 Adding the new SI prefixes

Depends on D153192 <https://reviews.llvm.org/D153192>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153200

Files:
  libcxx/docs/Status/Cxx2cPapers.csv
  libcxx/include/ratio
  libcxx/utils/generate_feature_test_macro_components.py


Index: libcxx/utils/generate_feature_test_macro_components.py
===================================================================
--- libcxx/utils/generate_feature_test_macro_components.py
+++ libcxx/utils/generate_feature_test_macro_components.py
@@ -848,7 +848,6 @@
             "name": "__cpp_lib_ratio",
             "values": {"c++26": 202306}, # P2734R0 Adding the new SI prefixes
             "headers": ["ratio"],
-            "unimplemented": True,
         },
         {
             "name": "__cpp_lib_raw_memory_algorithms",
Index: libcxx/include/ratio
===================================================================
--- libcxx/include/ratio
+++ libcxx/include/ratio
@@ -40,6 +40,8 @@
 template <class R1, class R2> struct ratio_greater_equal;
 
 // convenience SI typedefs
+using quecto = ratio <1 , 1'000'000'000'000'000'000'000'000'000'000>; // Since C++26 not supported
+using ronto = ratio <1 , 1'000'000'000'000'000'000'000'000'000>;      // Since C++26 not supported
 typedef ratio<1, 1000000000000000000000000> yocto;  // not supported
 typedef ratio<1,    1000000000000000000000> zepto;  // not supported
 typedef ratio<1,       1000000000000000000> atto;
@@ -60,6 +62,8 @@
 typedef ratio<      1000000000000000000, 1> exa;
 typedef ratio<   1000000000000000000000, 1> zetta;  // not supported
 typedef ratio<1000000000000000000000000, 1> yotta;  // not supported
+using ronna = ratio <1'000'000'000'000'000'000'000'000'000' 1>;      // Since C++26 not supported
+using quetta = ratio <1'000'000'000'000'000'000'000'000'000'000, 1>; // Since C++26 not supported
 
   // 20.11.5, ratio comparison
   template <class R1, class R2> inline constexpr bool ratio_equal_v
Index: libcxx/docs/Status/Cxx2cPapers.csv
===================================================================
--- libcxx/docs/Status/Cxx2cPapers.csv
+++ libcxx/docs/Status/Cxx2cPapers.csv
@@ -22,7 +22,7 @@
 "`P1759R6 <https://wg21.link/P1759R6>`__","LWG","Native handles and file streams","Varna June 2023","","",""
 "`P2697R1 <https://wg21.link/P2697R1>`__","LWG","Interfacing ``bitset`` with ``string_view``","Varna June 2023","","",""
 "`P1383R2 <https://wg21.link/P1383R2>`__","LWG","More ``constexpr`` for ``<cmath>`` and ``<complex>``","Varna June 2023","","",""
-"`P2734R0 <https://wg21.link/P2734R0>`__","LWG","Adding the new SI prefixes","Varna June 2023","","",""
+"`P2734R0 <https://wg21.link/P2734R0>`__","LWG","Adding the new SI prefixes","Varna June 2023","|Complete|","Clang 17",""
 "`P2548R6 <https://wg21.link/P2548R6>`__","LWG","``copyable_function``","Varna June 2023","","",""
 "`P2714R1 <https://wg21.link/P2714R1>`__","LWG","Bind front and back to NTTP callables","Varna June 2023","","",""
 "`P2630R4 <https://wg21.link/P2630R4>`__","LWG","``submdspan``","Varna June 2023","","",""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153200.532399.patch
Type: text/x-patch
Size: 2795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230617/5fc496f8/attachment-0001.bin>


More information about the libcxx-commits mailing list