This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

4273. Standard execution policy types should be conventional tag class types

Section: 26.3.6 [execpol] Status: New Submitter: Jiang An Opened: 2025-06-03 Last modified: 2025-10-21

Priority: 3

View all issues with New status.

Discussion:

Existing standard execution policy types don't hold any state, and mostly act as disambiguating tags in parallel algorithms. Perhaps it will be better to ensure them to be similar to construction tag types, which possibly enables more desired usages.

Currently, libc++ makes these types non-movable, which is arguable undesired per the decision made in P3136R1.

[2025-10-21; Reflector poll.]

Set priority to 3 after reflector poll.

"Not seeing the point of this change. For code dealing with generic policies, it shouldn't be constructing new objects of the policy type (there could be implementation-defined policies, or ones added in future standards, which are not default-constructible). For code using a specific policy, just using the named variable is strictly less typing than constructing the type. Maybe NAD or LEWG." "Making them tag types helps e.g. P3481 where we have to store execution policies, and in P2500." "Don't you want copy constructible, not default constructible?"

Proposed resolution:

This wording is relative to N5008.

  1. Modify 26.3.6.3 [execpol.seq] as indicated:

    class execution::sequenced_policy { unspecified
    public:
      explicit sequenced_policy() = default; 
    };
    
  2. Modify 26.3.6.4 [execpol.par] as indicated:

    class execution::parallel_policy { unspecified
    public:
      explicit parallel_policy() = default; 
    };
    
  3. Modify 26.3.6.5 [execpol.parunseq] as indicated:

    class execution::parallel_unsequenced_policy { unspecified
    public:
      explicit parallel_unsequenced_policy() = default; 
    };
    
  4. Modify 26.3.6.6 [execpol.unseq] as indicated:

    class execution::unsequenced_policy { unspecified
    public:
      explicit unsequenced_policy() = default; 
    };
    
  5. Modify 26.3.6.7 [execpol.objects] as indicated:

    inline constexpr execution::sequenced_policy execution::seq{ unspecified };
    inline constexpr execution::parallel_policy execution::par{ unspecified };
    inline constexpr execution::parallel_unsequenced_policy execution::par_unseq{ unspecified };
    inline constexpr execution::unsequenced_policy execution::unseq{ unspecified };