Domain policies#

A domain policy is any class that provides an interface similar to the following class:

template<typename... Element>
class DomainPolicy
{
    public:

        auto within_domain(Element const... value) -> bool;
};

The policy is used to check whether input element values are part of an algorithm’s domain. For example, the sqrt algorithm only supports computing results for non-negative values. In case a negative value is passed in, within_domain should return false.

The lue::policy::AllValuesWithinDomain policy is special in that it will consider all input element values to be part of an algorithm’s domain. This policy can be used when it is guaranteed that this is the case. An optimizing compiler will completely remove the “check” from the code.

Algorithms that require a domain check typically use an custom, algorithm-specific domain policy.

template<typename ...Element>
class AllValuesWithinDomain#

Domain policy which assumes all input values are within the algorithm’s domain.

Template Parameters:

Element – Types of the input elements

Public Static Functions

static inline constexpr auto within_domain([[maybe_unused]] Element const... value) -> bool#

Return whether all element value (s) are within the domain.

This function always returns true.