Calico
|
Implementation of various features from C++11 for compatibility purposes. This module has been deprecated since v0.10.0. More...
Classes | |
struct | cal::add_const< T > |
Adds the const qualifier to the type. More... | |
struct | cal::add_cv< T > |
Adds both the const and volatile qualifiers to the type. More... | |
struct | cal::add_lvalue_reference< T > |
Converts the type into an lvalue reference. More... | |
struct | cal::add_pointer< T > |
Converts into a pointer type. More... | |
struct | cal::add_rvalue_reference< T > |
Converts the type into an rvalue reference, unless T is an lvalue reference, in which case the type is returned unchanged. If rvalue references are not supported, the type is returned unchanged. More... | |
struct | cal::add_volatile< T > |
Adds the volatile qualifier to the type. More... | |
struct | cal::common_type<> |
Returns a common type among the given types. Without support for variadic templates, this template can only support 2 template arguments. Without decltype support, the common type is only defined if the types are thes same). More... | |
struct | cal::conditional< Condition, TrueT, FalseT > |
Returns one of the types based on a boolean condition. More... | |
struct | cal::decay< T > |
Performs lvalue transformations and removes cv-qualifiers. More... | |
struct | cal::enable_if< Condition, T > |
Contains a type member equal to T if Condition is true . More... | |
struct | cal::extent< T, N > |
Obtains the number of elements along the N -th dimension (or zero if unknown or outside bounds). More... | |
struct | cal::get_iterator< class > |
Obtains the default iterator type of a container or array (deprecated). More... | |
struct | cal::integral_constant< T, Value > |
Represents a compile-time constant of integral type. More... | |
struct | cal::is_abstract< T > |
Checks if a type is an abstract type. More... | |
struct | cal::is_arithmetic< T > |
Returns whether the type is an integral or floating-point type. More... | |
struct | cal::is_array< T > |
Returns whether the type is an array type. More... | |
struct | cal::is_base_of< Base, Derived > |
Checks if a type is derived from another type. More... | |
struct | cal::is_const< T > |
Returns whether the type is const -qualified. More... | |
struct | cal::is_convertible< From, To > |
Checks if the type From can be converted to To . More... | |
struct | cal::is_floating_point< T > |
Returns whether the type is a floating-point type (only works on fundamental types). More... | |
struct | cal::is_function< class > |
Returns whether the the type is a function type (up to 5 arguments if variadic templates are not supported). More... | |
struct | cal::is_integral< T > |
Returns whether the type is an integral type (only works on fundamental types). More... | |
struct | cal::is_lvalue_reference< T > |
Returns whether the type is an lvalue or rvalue reference. More... | |
struct | cal::is_pointer< T > |
Returns whether the type is an object pointer type. More... | |
struct | cal::is_reference< T > |
Returns whether the type is an lvalue or rvalue reference. More... | |
struct | cal::is_rvalue_reference< T > |
Returns whether the type is an rvalue reference. More... | |
struct | cal::is_same< class, class > |
Returns whether the types are the same. More... | |
struct | cal::is_void< T > |
Returns whether the type is a void type. More... | |
struct | cal::is_volatile< T > |
Returns whether the type is volatile -qualified. More... | |
struct | cal::make_signed< T > |
Converts an integral type to a signed type (only works on fundamental types, excluding char ). More... | |
struct | cal::make_unsigned< T > |
Converts an integral type to a unsigned type (only works on fundamental types, excluding char ). More... | |
struct | cal::match_cv< T, Target > |
Obtains a type related to T with the same const-volatile qualifiers as Target . More... | |
struct | cal::rank< T > |
Returns the number of dimensions in the array type. More... | |
struct | cal::remove_all_extents< T > |
Removes all the dimensions of an array type. More... | |
struct | cal::remove_const< T > |
Removes the const qualifier from the type. More... | |
struct | cal::remove_cv< T > |
Removes both the const and volatile qualifiers from the type. More... | |
struct | cal::remove_extent< T > |
Removes the first dimension of an array type. More... | |
struct | cal::remove_pointer< T > |
Converts to a non-pointer type. More... | |
struct | cal::remove_reference< T > |
Converts to a non-reference type. More... | |
struct | cal::remove_volatile< T > |
Removes the volatile qualifier from the type. More... | |
struct | cal::result_of< T > |
Deduces the return type of a function call (up to 5 arguments if variadic templates are not supported). If decltype is not available, it will use the result_type member of the function. More... | |
struct | cal::unparenthesize_type< void(T)> |
Used to remove parentheses around a type expression: when a type T is passed in as a function type of the form void(T) , a typedef named type is provided to recover the type T . More... | |
struct | cal::valid_call< T > |
Returns whether the function call is valid. When the template parameter is equal to F(T...) , it will return true if the function object F can be called with parameters of type T... . If variadic templates are not supported, a maximum of 5 arguments are supported. More... | |
struct | std::hash< Key > |
Hash function declaration (no specializations provided). More... | |
Macros | |
#define | CALICO_DECLTYPE(expr, fallback_type) decltype(expr) |
Attempts to compute the static type of expr with a fallback_type if this fails (deprecated). More... | |
#define | CALICO_ENABLE_IF(condition, type_expr) type_expr |
Convenience macro for performing enable_if tests (deprecated). More... | |
#define | CALICO_ENABLE_IF_P(condition) , typename ::cal::enable_if<(condition)>::type* = 0 |
Convenience macro for performing enable_if tests in the parameter list (deprecated). More... | |
#define | CALICO_UNPARENS(type_expr) auto |
Removes the parentheses around a type expression (deprecated). More... | |
#define | CALICO_VALID_TYPE(type_expr, return_type) return_type |
Returns the return_type if type_expr is a valid type; causes a compiler error otherwise (deprecated). More... | |
#define | CALICO_VALID_VAL(value_expr, return_value) return_value |
Constructs an unevaluated context for the given expression to test the its validity (deprecated). More... | |
Typedefs | |
typedef integral_constant < bool, false > | cal::false_type |
An alias to integral_constant with a value of false . | |
typedef integral_constant < bool, true > | cal::true_type |
An alias to integral_constant with a value of true . | |
typedef unsigned | cal::uint_fast16_t |
Fastest unsigned integer type with a width of at least 16 bits. | |
Functions | |
template<class T > | |
T * | cal::addressof (T &x) |
Obtains the address of an object even if operator& is overloaded. | |
template<class C > | |
auto | cal::begin (C &c) |
Returns an iterator to the beginning of a container. | |
template<class C > | |
auto | cal::begin (const C &c) |
Returns an iterator to the beginning of a container. | |
template<class T , std::size_t N> | |
T * | cal::begin (T(&array)[N]) |
Returns an iterator to the beginning of an array. | |
template<class Iterator > | |
Iterator | std::begin (const std::pair< Iterator, Iterator > &p) |
Returns the first item in an iterator pair (deprecated). More... | |
template<class C > | |
auto | cal::cbegin (const C &c) |
Returns a const-qualified iterator to the beginning of a container. | |
template<class C > | |
auto | cal::cend (const C &c) |
Returns a const-qualified iterator to the end of a container. | |
template<class T > | |
add_rvalue_reference< T >::type | cal::declval () |
Converts a type into an unevaluated operand. | |
template<class C > | |
auto | cal::end (C &c) |
Returns an iterator to the end of a container. | |
template<class C > | |
auto | cal::end (const C &c) |
Returns an iterator to the end of a container. | |
template<class T , std::size_t N> | |
T * | cal::end (T(&array)[N]) |
Returns an iterator to the end of an array. | |
template<class Iterator > | |
Iterator | std::end (const std::pair< Iterator, Iterator > &p) |
Returns the second item in an iterator pair (deprecated). More... | |
template<class T > | |
constexpr T && | cal::forward (typename remove_reference< T >::type &&t) |
Perfectly forwards the given argument. | |
template<class T > | |
remove_reference< T >::type && | cal::move (T &&t) |
Converts an rvalue reference into an xvalue. | |
template<class T > | |
std::string | cal::to_string (const T &x) |
Constructs a string representation of an object using the stream insertion operator (<< ). | |
Variables | |
typedef | cal::uint16_t |
16-bit unsigned integer type. | |
typedef | cal::uint32_t |
32-bit unsigned integer type. | |
typedef | cal::uint64_t |
64-bit unsigned integer type. | |
Implementation of various features from C++11 for compatibility purposes. This module has been deprecated since v0.10.0.
A set of macros is used determine the availability of C++11 features in some common compilers, assuming they even have these kinds of things properly documented (which is often not the case). Note that despite what the standard says, the __cplusplus
macro is not be trusted as compilers can and will lie about it (e.g. Clang).
The feature tests (or more accurately, version tests) are incomplete and do not support every compiler. Full feature testing is best provided by actual build tools.
If the compiler does in fact support every feature of C++11 correctly (quite unlikely) then feel free to define the HAVE_CXX11
macro; otherwise, use the individual HAVE_
... feature macros instead.
Some useful information can be found here:
For MSVC, the values of the version macro are:
_MSC_VER = 1700 for Visual Studio 2012 / 11.0 _MSC_VER = 1600 for Visual Studio 2010 / 10.0 _MSC_VER = 1500 for Visual Studio 2008 / 9.0 _MSC_VER < 1500 for ancient, unsupported versions
For unsupported compilers, the preferable approach is to add specific feature tests into the build system (e.g. Autoconf, CMake) and then define the appropriate HAVE_
... macros.
#define CALICO_DECLTYPE | ( | expr, | |
fallback_type | |||
) | decltype(expr) |
Attempts to compute the static type of expr
with a fallback_type
if this fails (deprecated).
Equivalent to decltype(expr)
if available; otherwise, defaults to the fallback_type
provided that the expression is valid (the macro uses an enable_if
check to do this).
Consider using the following instead:
#define CALICO_ENABLE_IF | ( | condition, | |
type_expr | |||
) | type_expr |
Convenience macro for performing enable_if
tests (deprecated).
Consider using the following instead:
#define CALICO_ENABLE_IF_P | ( | condition | ) | , typename ::cal::enable_if<(condition)>::type* = 0 |
Convenience macro for performing enable_if
tests in the parameter list (deprecated).
Consider using either default template function arguments or the following replacement instead (including the initial comma):
#define CALICO_UNPARENS | ( | type_expr | ) | auto |
Removes the parentheses around a type expression (deprecated).
Use the following instead:
#define CALICO_VALID_TYPE | ( | type_expr, | |
return_type | |||
) | return_type |
Returns the return_type
if type_expr
is a valid type; causes a compiler error otherwise (deprecated).
The result can be used to perform SFINAE tests.
Consider using the following instead:
#define CALICO_VALID_VAL | ( | value_expr, | |
return_value | |||
) | return_value |
Constructs an unevaluated context for the given expression to test the its validity (deprecated).
Returns the return_value
if value_expr
is valid; causes a compiler error otherwise. The result can be used to perform SFINAE tests.
Use the following instead:
|
inline |
Returns the first item in an iterator pair (deprecated).
Consider using cal::iterator_range
instead.
|
inline |
Returns the second item in an iterator pair (deprecated).
Consider using cal::iterator_range
instead.