Talk:cpp/symbol index/macro
From cppreference.com
< Talk:cpp | symbol index
__cpp_lib_is_implicit_lifetime, __cpp_lib_modules, and __cpp_lib_ranges_enumerate are missing from this page.
Marklmi (talk) 14:56, 4 April 2023 (PDT)
__cpp_lib_int_pow2 is listed out of order compared to other pages. Relative to __cpp_lib_integer_... it is normally listed first. That would look like:
__cpp_lib_int_pow2 (since C++20)
__cpp_lib_integer_comparison_functions (since C++20)
__cpp_lib_integer_sequence (since C++20)
Marklmi (talk) 15:19, 4 April 2023 (PDT)
- ✔ Done Yes, thank your. It is all fixed now. Here is a simple script that can help to find the absent FTMs from draft:
[edit] FTM finder
Can be used online too
Run this code
// This program finds the Feature Testing Macros absent in cppreference's FTM list. // // Usage: // Fill in the arrays (string_view's) at the end of this file and compile/run this script. // A compiler options could be: c++ --std=c++20 -O2 ./print_absent_macros.cpp -o o && ./o // The absent Feature Testing Macros will be sent to stdout. // // Source page1: "http://eel.is/c++draft/libraryindex" // Source page2: "https://en.cppreference.com/w/cpp/symbol_index/macro" #include <algorithm> #include <iostream> #include <iterator> #include <string_view> #include <utility> #include <vector> using VSW = std::vector<std::string_view>; inline void print_differences(VSW&& v1, VSW&& v2) { std::ranges::sort(v1); std::ranges::sort(v2); std::ranges::set_difference(v1, v2, std::ostream_iterator<std::string_view>(std::cout, "\n")); } inline VSW collect_macros(std::string_view const source) { struct StrPos{ std::string_view str; size_t pos{}; bool found() const { return not str.empty(); } }; auto find_next_macro = [](std::string_view const source, size_t const pos) -> StrPos { constexpr std::string_view prefix{"__cpp_lib_"}; auto first = source.find(prefix, pos); if (first == source.npos) return {}; auto last = source.find_first_of("},", first + prefix.length() + 1); if (last == source.npos) return {}; return { {source.cbegin() + first, last - first}, last + 1 }; }; VSW macros; for (StrPos sp; sp = find_next_macro(source, sp.pos), sp.found();) macros.push_back(sp.str); return macros; } int main() { extern const std::string_view ftm_in_draft; extern const std::string_view ftm_in_cppreference; print_differences(collect_macros(ftm_in_draft), collect_macros(ftm_in_cppreference)); } // Fill from the source: "http://eel.is/c++draft/libraryindex" // constexpr std::string_view ftm_in_draft = R"-( __cpp_lib_adaptor_iterator_pair_constructor, [version.syn] __cpp_lib_addressof_constexpr, [version.syn] __cpp_lib_algorithm_iterator_requirements, [version.syn] __cpp_lib_allocate_at_least, [version.syn] __cpp_lib_allocator_traits_is_always_equal, [version.syn] __cpp_lib_any, [version.syn] __cpp_lib_apply, [version.syn] __cpp_lib_array_constexpr, [version.syn] __cpp_lib_as_const, [version.syn] ... the rest is not shown ... )-"; // Fill from "https://en.cppreference.com/w/cpp/symbol_index/macro" // constexpr std::string_view ftm_in_cppreference = R"-( {{ltt|cpp/utility/feature_test|__cpp_lib_adaptor_iterator_pair_constructor}} {{mark since c++23}}<br> {{ltt|cpp/utility/feature_test|__cpp_lib_addressof_constexpr}} {{mark since c++20}}<br> {{ltt|cpp/utility/feature_test|__cpp_lib_algorithm_iterator_requirements}} {{mark since c++23}}<br> {{ltt|cpp/utility/feature_test|__cpp_lib_allocate_at_least}} {{mark since c++23}}<br> {{ltt|cpp/utility/feature_test|__cpp_lib_allocator_traits_is_always_equal}} {{mark since c++20}}<br> {{ltt|cpp/utility/feature_test|__cpp_lib_any}} {{mark since c++20}}<br> {{ltt|cpp/utility/feature_test|__cpp_lib_apply}} {{mark since c++20}}<br> ... the rest is not shown ... )-";
Possible output:
__cpp_lib_common_reference __cpp_lib_common_reference_wrapper __cpp_lib_formatters __cpp_lib_is_implicit_lifetime __cpp_lib_modules __cpp_lib_ranges_enumerate __cpp_lib_ranges_find_last
- --Space Mission (talk) 09:45, 5 April 2023 (PDT)
- --Space Mission (talk) 14:15, 5 April 2023 (PDT)