Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::detail::nonesuch Struct Reference

Helper struct which cannot be constructed (or destroyed) at all. More...

#include <acts/blob/sPHENIX/Core/include/Acts/Utilities/TypeTraits.hpp>

Public Member Functions

 ~nonesuch ()=delete
 
 nonesuch (nonesuch const &)=delete
 
void operator= (nonesuch const &)=delete
 

Detailed Description

Helper struct which cannot be constructed (or destroyed) at all.

This file contains an implementation of the detection idiom in C++. It's not currently in the standard, but can be implemented using standard features. This implementation is largely taken from the C++ technical specifications, library fundamentals v2

The detector pattern works like this: there is a default type, that accepts an "operation" that can be basically anything. It also accepts variadic arguments for that operation. The default type has a member type that is std::false_type to indicate success or failure. It also has a member type "type" which captures a type result. Then there is a specialization which attempts to instantiate the operation with the given parameters, and tries to assign it into std::void_t. If the operation fails to instantiate (say, the checked for type does not exist), the specialization will not be instantiated, and the compiler falls back to the default type which contains std::false_type. Since it happens inside while the compiler tries to find a better matching template specialization than the default one (so basically overload resolution), a compile error inside the operation is handled as a substitution failure, and is not an error. If the instantiation succeeds, the specialization contains a std::true_type, and an alias to the result of the operation.

Essentially, it provides a convenient way to "lift" operations into this overload resolution, allowing testing expressions and evaluating them into compile time booleans (instead of compilation failures).

Definition at line 46 of file TypeTraits.hpp.

View newest version in sPHENIX GitHub at line 46 of file TypeTraits.hpp

Constructor & Destructor Documentation

Acts::detail::nonesuch::~nonesuch ( )
delete
Acts::detail::nonesuch::nonesuch ( nonesuch const &  )
delete

Member Function Documentation

void Acts::detail::nonesuch::operator= ( nonesuch const &  )
delete

The documentation for this struct was generated from the following file: