DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
docwire::invocation_traits Namespace Reference

Provides traits classes for working with callable objects. More...

Classes

struct  args
 Extracts the argument types of a callable object. More...
 
struct  result
 Extracts the result type of a callable object. More...
 
struct  is_invocable
 Trait that checks if a type is invocable. More...
 

Typedefs

template<typename T >
using args_t = typename args< T >::type
 Type alias for the type member of the args struct. More...
 
template<typename T >
using result_t = typename result< T >::type
 Type alias for the type member of the result struct. More...
 

Variables

template<typename T >
constexpr std::size_t arity_v = std::tuple_size_v<args_t<T>>
 
template<typename T >
constexpr bool is_invocable_v = is_invocable<T>::value
 Variable template alias for the value of the is_invocable trait. More...
 

Detailed Description

Provides traits classes for working with callable objects.

This namespace contains traits classes that can be used to extract information about callable objects, such as their argument types and return types. It also provides a way to check if a type is invocable.

Typedef Documentation

◆ args_t

template<typename T >
using docwire::invocation_traits::args_t = typedef typename args<T>::type

Type alias for the type member of the args struct.

The args struct is a meta-programming utility providing a convenient way to access the argument types of a callable object, with a fallback mechanism for cases where boost::callable_traits is not sufficient.

This type alias provides a shortcut for accessing the type member of the args struct.

Template Parameters
TThe type parameter for the args struct, typically a function type.
See also
args

Definition at line 91 of file invocation_traits.h.

◆ result_t

template<typename T >
using docwire::invocation_traits::result_t = typedef typename result<T>::type

Type alias for the type member of the result struct.

The result struct is a meta-programming utility providing a convenient way to access the result type of a callable object, with a fallback mechanism for cases where boost::callable_traits is not sufficient.

This type alias provides a shortcut for accessing the type member of the result struct.

Template Parameters
TThe type parameter for the result struct, typically a function type.
See also
result

Definition at line 158 of file invocation_traits.h.

Variable Documentation

◆ is_invocable_v

template<typename T >
constexpr bool docwire::invocation_traits::is_invocable_v = is_invocable<T>::value
inlineconstexpr

Variable template alias for the value of the is_invocable trait.

This variable template provides a convenient way to access the value of the is_invocable trait as a constant expression. It is equivalent to the nested value is_invocable<T>::value, but is often more readable and easier to use.

The is_invocable trait checks if a type is invocable, meaning it can be called like a function. Unlike std::is_invocable, this trait does not require specifying the argument types, making it easier to use with types that have complex or variable invocation signatures.

Additionally, this trait supports functors with overloaded operator() and other types that provide a public operator() signature through mechanisms such as invocation_args_t. This makes it a more comprehensive and robust solution for checking invocability.

The trait uses boost::callable_traits to check for invocability, and provides a fallback mechanism in cases where boost::callable_traits is not sufficient. The fallback mechanism relies on the presence of a public invocation_args_t type definition in the functor class.

Template Parameters
TThe type to check for invocability.

Definition at line 211 of file invocation_traits.h.