GL Studio C++ Runtime API
gls_cpp_lang_support.h File Reference

Macros and helper code to determine what subset of C++11/14/17 is available. More...

#include <utility>
#include <float.h>

Go to the source code of this file.

Classes

struct  MaxDigits10< T >
 
struct  MaxDigits10< float >
 
struct  MaxDigits10< double >
 
struct  MaxDigits10< long double >
 

Namespaces

namespace  disti
 Force inclusion of the DirectShow library.
 

Macros

#define DISTI_HAS_CPP11
 Defines whether or not C++11 support is available.
 
#define DISTI_HAS_DEPRECATED_ATTRIBUTE
 Defines whether this compiler supports the C++14 deprecated attribute.
 
#define DISTI_IF_HAS_CPP11(x)   x
 Macro to wrap code that should be excluded if C++11 support is not available.
 
#define DISTI_IF_HAS_CPP11_ELSE(x, y)   x
 Macro to wrap code that has two implementations, one for C++11 support and the other without.
 
#define DISTI_HAS_RVAL_REFS
 Defines whether or not this compiler supports move semantics.
 
#define DISTI_HAS_METHOD_OVERRIDE
 Defines whether or not this compiler supports the override keyword.
 
#define DISTI_HAS_SPECIAL_MEM_FUN_DEL
 Defines whether or not this compiler supports deleted functions.
 
#define DISTI_HAS_TYPE_TRAITS
 Defines whether or not this compiler supports type traits.
 
#define DISTI_HAS_STATIC_ASSERT
 Defines whether or not this compiler supports static assertion.
 
#define DISTI_RVAL_MOVE(x)   std::move( x )
 Macro to wrap std::move, removed on compilers that don't support it.
 
#define DISTI_UREF_FORWARD(T, x)   std::forward<T>( x )
 Macro to wrap std::forward, removed on compilers that don't support it.
 
#define DISTI_UREF(T)   T&&
 Macro to wrap r-value reference, removed on playforms that don't support it.
 
#define DISTI_IF_HAS_RVAL_REFS(x)   x
 Macro to wrap code that should be excluded if r-value references aren't supported.
 
#define DISTI_IF_HAS_RVAL_REFS_ELSE(x, y)   x
 Macro to wrap code that has two implementations, one for r-value reference support, and the other without.
 
#define DISTI_METHOD_OVERRIDE   override
 Macro to wrap the override keyword, removed on compilers that don't support it.
 
#define DISTI_FINAL   final
 Macro to wrap the final keyword, removed on compilers that don't support it.
 
#define DISTI_FUNC_NOEXCEPT
 Macro to wrap the noexcept keyword, removed on compilers that don't support it.
 
#define DISTI_SPECIAL_MEM_FUN_DELETE   = delete
 Macro to wrap function deletion, removed on compilers that don't support it.
 
#define DISTI_IF_HAS_USER_DEFINED_LITERAL(x)
 Macro to wrap user defined literals, removed on compilers that don't support them.
 
#define DISTI_IF_HAS_TYPE_TRAITS_ELSE(x, y)   x
 
#define DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO(T, ConvertsTo)   DISTI_STATIC_ASSERT( ( std::is_convertible<T*, ConvertsTo*>::value ), class_does_not_inherit_from_##ConvertsTo );
 
#define DISTI_IS_TRIVIALLY_DESTRUCTIBLE(T)   ( std::is_trivially_destructible<T>() )
 Determines if a class T is trivially destructible (i.e., has no side effects)
 
#define DISTI_TT_TRUE_TYPE   std::true_type
 Macro wrapping std::true_type, removed on compilers that don't support it.
 
#define DISTI_TT_FALSE_TYPE   std::false_type
 Macro wrapping std::false_type, removed on compilers that don't support it.
 
#define DISTI_PREPROC_STRINGIFY_HELPER(s)   # s
 Inner macro for preprocessor stringification, do not use this macro directly.
 
#define DISTI_PREPROC_STRINGIFY(s)   DISTI_PREPROC_STRINGIFY_HELPER( s )
 Use this macro to convert a preprocessor define into a literal string.
 
#define DISTI_STATIC_ASSERT(expr, msg)   static_assert( expr, DISTI_PREPROC_STRINGIFY( msg ) )
 Uses C++11's static_assert() because it is available on this platform. More...
 
#define DISTI_STATIC_ASSERT_STR(expr, msg)   static_assert( expr, msg )
 Uses C++11's static_assert() because it is available on this platform. More...
 
#define DISTI_DEPRECATED(msg)   [[deprecated( msg )]]
 Defines whether this compiler supports the C++14 deprecated attribute.
 

Detailed Description

Macros and helper code to determine what subset of C++11/14/17 is available.

Copyright Information

Copyright (c) 2016 The DiSTI Corporation.
11486 Corporate Blvd; Suite 190
Orlando, Florida 32817
USA

All rights reserved.

This Software contains proprietary trade secrets of DiSTI and may not be reproduced, in whole or part, in any form, or by any means of electronic, mechanical, or otherwise, without the written permission of DiSTI. Said permission may be derived through the purchase of applicable DiSTI product licenses which detail the distribution rights of this content and any Derivative Works based on this or other copyrighted DiSTI Software.

NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND, AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.

LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT EXCEED FIVE DOLLARS (US$5.00).

The aforementioned terms and restrictions are governed by the laws of the State of Florida and the United States of America.

Macro Definition Documentation

◆ DISTI_IF_HAS_TYPE_TRAITS_ELSE

#define DISTI_IF_HAS_TYPE_TRAITS_ELSE (   x,
 
)    x

Use this by including <type_traits> and then providing a default, e.g.,

DISTI_IF_HAS_TYPE_TRAITS_ELSE( std::is_const\<T\>::value, false )
#define DISTI_IF_HAS_TYPE_TRAITS_ELSE(x, y)
Definition: gls_cpp_lang_support.h:256

◆ DISTI_STATIC_ASSERT

#define DISTI_STATIC_ASSERT (   expr,
  msg 
)    static_assert( expr, DISTI_PREPROC_STRINGIFY( msg ) )

Uses C++11's static_assert() because it is available on this platform.

Parameters
expra compile-time integral or pointer expression
msga C identifier that will appear in compiler diagnostics
Note
For older compilers' benefit, msg should be a C identifier such as:
DISTI_STATIC_ASSERT( (std::is_convertible<T*,ConvertsTo*>::value), class_does_not_inherit_from_##ConvertsTo )
#define DISTI_STATIC_ASSERT(expr, msg)
Uses C++11's static_assert() because it is available on this platform.
Definition: gls_cpp_lang_support.h:396
which shows a compile-time error that typically includes: "ERROR_class_does_not_inherit_from_Group". If it is not a C identifier, you may get spurious error messages at compile time compilers without static_assert.

◆ DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO

#define DISTI_STATIC_ASSERT_IS_CONVERTIBLE_TO (   T,
  ConvertsTo 
)    DISTI_STATIC_ASSERT( ( std::is_convertible<T*, ConvertsTo*>::value ), class_does_not_inherit_from_##ConvertsTo );

Convenience macro to check that one type converts to another at compile-time.

Parameters
TA class to check
ConvertsToA class to test T* against to verify that it can be converted to ConvertsTo* without a cast.

◆ DISTI_STATIC_ASSERT_STR

#define DISTI_STATIC_ASSERT_STR (   expr,
  msg 
)    static_assert( expr, msg )

Uses C++11's static_assert() because it is available on this platform.

Parameters
expra compile-time integral or pointer expression with a string message.
msga string to help the developer determine what went wrong.
DISTI_STATIC_ASSERT_STR( (std::is_convertible<T*, Base*>::value), "Class does not inherit from Base." );
#define DISTI_STATIC_ASSERT_STR(expr, msg)
Uses C++11's static_assert() because it is available on this platform.
Definition: gls_cpp_lang_support.h:405
Note
Adapted from Loki 0.1.7.