common_type< Ts > Struct Template Reference

Similar to std::common_type but addresses several issues. More...

#include <atria/meta/common_type.hpp>

Detailed Description

template<typename... Ts>
struct atria::meta::common_type< Ts >

Similar to std::common_type but addresses several issues.

First, on Clang 3.4, common_type fails for void, where it should not. Also, the standard common type removes qualification, which we want to preserve. Also, common_type is SFINAE-friendly only in new versions of GCC.

This implementation preserves qualification when possible, and also is total. When no common type is found, it returns the special type CouldNotFindCommonType, which can be instantiated and converted from anything. This makes it easier to write functions that return a common-type of other types, but that might be used in expressions where the return type is to be discarded. This erroneous type was chosen instead of void to make debugging easier.

Definition at line 115 of file common_type.hpp.


The documentation for this struct was generated from the following file:
Fork me on GitHub