Skip to content

Conversation

@zasdfgbnm
Copy link
Collaborator

No description provided.

@zasdfgbnm
Copy link
Collaborator Author

!test

@github-actions
Copy link

github-actions bot commented Jan 13, 2026

Review updated until commit 31bd63e

Description

  • Modernize DynamicType implementation to use C++20 concepts instead of SFINAE

  • Replace std::enable_if_t patterns with requires clauses for better readability

  • Update type trait checks to use concept-based constraints

  • Maintain backward compatibility while improving code clarity

Changes walkthrough

Relevant files
Enhancement
polymorphic_value.h
Remove SFINAE from StructHandle operator                                 

csrc/polymorphic_value.h

  • Remove SFINAE constraint from StructHandle::operator->* method
  • Simplify operator->* implementation by removing std::enable_if_t
  • +1/-2     
    dynamic_type.h
    Comprehensive modernization to C++20 concepts                       

    lib/dynamic_type/src/dynamic_type/dynamic_type.h

  • Add #include for C++20 concepts support
  • Replace std::enable_if_t with requires clauses in constructors
  • Modernize as() methods to use concept constraints
  • Update cast operators with concept-based constraints
  • Convert square bracket operators to use requires clauses
  • Modernize operator->* implementations with concepts
  • Update binary/unary operators to use concept constraints
  • Replace assignment operator SFINAE with requires clauses
  • +98/-97 
    type_traits.h
    Modernize type traits with C++20 concepts                               

    lib/dynamic_type/src/dynamic_type/type_traits.h

  • Add #include for C++20 concepts support
  • Replace can_use_args SFINAE implementation with concept
  • Modernize HasArrowOperator trait to use concept
  • Update HasExplicitConversion to use concept-based approach
  • Simplify OperatorChecker with concept constraints
  • +35/-54 

    PR Reviewer Guide

    Here are some key observations to aid the review process:

    🧪 No relevant tests
    ⚡ Recommended focus areas for review
    Concept compatibility

    The PR introduces C++20 concepts but doesn't include version checks or fallback mechanisms. Ensure the codebase has proper C++20 feature detection and that this change won't break builds on older compilers that don't support concepts.

    #include <concepts>
    Backward compatibility

    The PR removes the can_use_args_impl namespace and replaces it with concepts, but maintains compatibility variable templates. Verify that all existing code depending on the previous implementation still works correctly, especially in edge cases involving SFINAE interactions.

    namespace dynamic_type {
    
    // Concept to check if a function Fun can be called with arguments Ts...
    template <typename Fun, typename... Ts>
    concept CanUseArgs = requires(Fun f, Ts... args) {
      {f(args...)};
    };
    
    // Compatibility variable template for existing code
    template <typename Fun, typename... Ts>
    constexpr bool can_use_args = CanUseArgs<Fun, Ts...>;
    Concept constraint validation

    Several complex template instantiations now use concepts instead of enable_if. The requires clauses should be thoroughly tested to ensure they properly constrain the templates in all edge cases, particularly with template template parameters and SFINAE-prone scenarios.

    template <template <typename...> typename Template, typename ItemT>
    requires(
        is_candidate_type<Template<DynamicType>> &&
        !std::is_same_v<ItemT, DynamicType>) constexpr DynamicType(Template<ItemT>
                                                                       value)
        : value([](auto input) {

    @zasdfgbnm
    Copy link
    Collaborator Author

    !test

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants