8183927: Hotspot needs C++ type_traits metaprogramming utilities

This changeset introduces new metaprogramming utilities typically found in <type_traits> in C++11.

Co-authored-by: Kim Barrett <kim.barrett@oracle.com>
Reviewed-by: kbarrett, rehn, pliden
This commit is contained in:
Erik Österlund 2017-07-11 12:00:48 +02:00
parent ad941e4f9d
commit 454e63fe90
27 changed files with 1266 additions and 0 deletions

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_CONDITIONAL_HPP
#define SHARE_VM_METAPROGRAMMING_CONDITIONAL_HPP
#include "memory/allocation.hpp"
// This trait evaluates its typedef called "type" to TrueType iff the condition
// is true. Otherwise it evaluates to FalseType.
template <bool condition, typename TrueType, typename FalseType>
struct Conditional: AllStatic {
typedef TrueType type;
};
template <typename TrueType, typename FalseType>
struct Conditional<false, TrueType, FalseType>: AllStatic {
typedef FalseType type;
};
#endif // SHARE_VM_METAPROGRAMMING_CONDITIONAL_HPP

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_DECAY_HPP
#define SHARE_VM_METAPROGRAMMING_DECAY_HPP
#include "memory/allocation.hpp"
#include "metaprogramming/removeCV.hpp"
#include "metaprogramming/removeReference.hpp"
// This trait trims the type from CV qualifiers and references.
// This trait provides a subset of the functionality of std::decay;
// array types and function types are not supported here.
template <typename T>
struct Decay: AllStatic {
typedef typename RemoveCV<typename RemoveReference<T>::type>::type type;
};
#endif // SHARE_VM_METAPROGRAMMING_DECAY_HPP

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ENABLEIF_HPP
#define SHARE_VM_METAPROGRAMMING_ENABLEIF_HPP
#include "memory/allocation.hpp"
// This metaprogramming tool allows explicitly enabling and disabling overloads
// of member functions depending on whether the condition B holds true.
// For example typename EnableIf<IsPointer<T>::value>::type func(T ptr) would
// only become an overload the compiler chooses from if the type T is a pointer.
// If it is not, then the template definition is not expanded and there will be
// no compiler error if there is another overload of func that is selected when
// T is not a pointer. Like for example
// typename EnableIf<!IsPointer<T>::value>::type func(T not_ptr)
template <bool B, typename T = void>
struct EnableIf: AllStatic {};
template <typename T>
struct EnableIf<true, T>: AllStatic {
typedef T type;
};
#endif // SHARE_VM_METAPROGRAMMING_ENABLEIF_HPP

View File

@ -0,0 +1,60 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_INTEGRALCONSTANT_HPP
#define SHARE_VM_METAPROGRAMMING_INTEGRALCONSTANT_HPP
#include "memory/allocation.hpp"
// An Integral Constant is a class providing a compile-time value of an
// integral type. An Integral Constant is also a nullary metafunction,
// returning itself. An integral constant object is implicitly
// convertible to the associated value.
//
// A type n is a model of Integral Constant if it meets the following
// requirements:
//
// n::ValueType : The integral type of n::value
// n::value : An integral constant expression
// n::type : IsSame<n::type, n>::value is true
// n::value_type const c = n() : c == n::value
// A model of the Integer Constant concept.
// T is an integral type, and is the value_type.
// v is an integral constant, and is the value.
template<typename T, T v>
struct IntegralConstant : AllStatic {
typedef T value_type;
static const value_type value = v;
typedef IntegralConstant<T, v> type;
operator value_type() { return value; }
};
// A bool valued IntegralConstant whose value is true.
typedef IntegralConstant<bool, true> TrueType;
// A bool valued IntegralConstant whose value is false.
typedef IntegralConstant<bool, false> FalseType;
#endif // SHARE_VM_METAPROGRAMMING_INTEGRALCONSTANT_HPP

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISCONST_HPP
#define SHARE_VM_METAPROGRAMMING_ISCONST_HPP
#include "metaprogramming/integralConstant.hpp"
template <typename T> struct IsConst: public FalseType {};
template <typename T> struct IsConst<const T>: public TrueType {};
#endif // SHARE_VM_METAPROGRAMMING_ISCONST_HPP

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISFLOATINGPOINT_HPP
#define SHARE_VM_METAPROGRAMMING_ISFLOATINGPOINT_HPP
#include "metaprogramming/integralConstant.hpp"
// This metafunction returns true iff the type T (irrespective of CV qualifiers)
// is a floating point type.
template <typename T> struct IsFloatingPoint: public FalseType {};
template <> struct IsFloatingPoint<float>: public TrueType {};
template <> struct IsFloatingPoint<const float>: public TrueType {};
template <> struct IsFloatingPoint<volatile float>: public TrueType {};
template <> struct IsFloatingPoint<const volatile float>: public TrueType {};
template <> struct IsFloatingPoint<double>: public TrueType {};
template <> struct IsFloatingPoint<const double>: public TrueType {};
template <> struct IsFloatingPoint<volatile double>: public TrueType {};
template <> struct IsFloatingPoint<const volatile double>: public TrueType {};
template <> struct IsFloatingPoint<long double>: public TrueType {};
template <> struct IsFloatingPoint<const long double>: public TrueType {};
template <> struct IsFloatingPoint<volatile long double>: public TrueType {};
template <> struct IsFloatingPoint<const volatile long double>: public TrueType {};
#endif // SHARE_VM_METAPROGRAMMING_ISFLOATINGPOINT_HPP

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISINTEGRAL_HPP
#define SHARE_VM_METAPROGRAMMING_ISINTEGRAL_HPP
#include "memory/allocation.hpp"
#include "metaprogramming/integralConstant.hpp"
#include "metaprogramming/isSigned.hpp"
#include "metaprogramming/removeCV.hpp"
#include <limits>
// This metafunction returns true iff the type T (irrespective of CV qualifiers)
// is an integral type. Note that this is false for enums.
template<typename T>
struct IsIntegral
: public IntegralConstant<bool, std::numeric_limits<typename RemoveCV<T>::type>::is_integer>
{};
// This metafunction returns true iff the type T (irrespective of CV qualifiers)
// is a signed integral type. Note that this is false for enums.
template<typename T>
struct IsSignedIntegral
: public IntegralConstant<bool, IsIntegral<T>::value && IsSigned<T>::value>
{};
// This metafunction returns true iff the type T (irrespective of CV qualifiers)
// is an unsigned integral type. Note that this is false for enums.
template<typename T>
struct IsUnsignedIntegral
: public IntegralConstant<bool, IsIntegral<T>::value && !IsSigned<T>::value>
{};
#endif // SHARE_VM_METAPROGRAMMING_ISINTEGRAL_HPP

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISPOINTER_HPP
#define SHARE_VM_METAPROGRAMMING_ISPOINTER_HPP
#include "metaprogramming/integralConstant.hpp"
// This metafunction returns true iff the type T is (irrespective of CV qualifiers)
// a pointer type.
template <typename T> class IsPointer: public FalseType {};
template <typename T> class IsPointer<T*>: public TrueType {};
template <typename T> class IsPointer<T* const>: public TrueType {};
template <typename T> class IsPointer<T* volatile>: public TrueType {};
template <typename T> class IsPointer<T* const volatile>: public TrueType {};
#endif // SHARE_VM_METAPROGRAMMING_ISPOINTER_HPP

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISSAME_HPP
#define SHARE_VM_METAPROGRAMMING_ISSAME_HPP
#include "metaprogramming/integralConstant.hpp"
// This trait returns true iff the two types X and Y are the same
template <typename X, typename Y>
struct IsSame: public FalseType {};
template <typename X>
struct IsSame<X, X>: public TrueType {};
#endif // SHARE_VM_METAPROGRAMMING_ISSAME_HPP

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISSIGNED_HPP
#define SHARE_VM_METAPROGRAMMING_ISSIGNED_HPP
#include "memory/allocation.hpp"
#include "metaprogramming/integralConstant.hpp"
#include "metaprogramming/removeCV.hpp"
#include <limits>
template<typename T>
struct IsSigned
: public IntegralConstant<bool, std::numeric_limits<typename RemoveCV<T>::type>::is_signed>
{};
#endif // SHARE_VM_METAPROGRAMMING_ISSIGNED_HPP

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_ISVOLATILE_HPP
#define SHARE_VM_METAPROGRAMMING_ISVOLATILE_HPP
#include "metaprogramming/integralConstant.hpp"
template <typename T> struct IsVolatile: public FalseType {};
template <typename T> struct IsVolatile<volatile T>: public TrueType {};
#endif // SHARE_VM_METAPROGRAMMING_ISVOLATILE_HPP

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_REMOVECV_HPP
#define SHARE_VM_METAPROGRAMMING_REMOVECV_HPP
#include "memory/allocation.hpp"
template <typename T>
struct RemoveCV: AllStatic {
typedef T type;
};
template <typename T>
struct RemoveCV<const T>: AllStatic {
typedef T type;
};
template <typename T>
struct RemoveCV<volatile T>: AllStatic {
typedef T type;
};
template <typename T>
struct RemoveCV<const volatile T>: AllStatic {
typedef T type;
};
#endif // SHARE_VM_METAPROGRAMMING_REMOVECV_HPP

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_REMOVEPOINTER_HPP
#define SHARE_VM_METAPROGRAMMING_REMOVEPOINTER_HPP
#include "memory/allocation.hpp"
// This metafunction returns for a type T either the underlying type behind
// the pointer iff T is a pointer type (irrespective of CV qualifiers),
// or the same type T if T is not a pointer type.
template <typename T> struct RemovePointer: AllStatic { typedef T type; };
template <typename T> struct RemovePointer<T*>: AllStatic { typedef T type; };
template <typename T> struct RemovePointer<T* const>: AllStatic { typedef T type; };
template <typename T> struct RemovePointer<T* volatile>: AllStatic { typedef T type; };
template <typename T> struct RemovePointer<T* const volatile>: AllStatic { typedef T type; };
#endif // SHARE_VM_METAPROGRAMMING_REMOVEPOINTER_HPP

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_METAPROGRAMMING_REMOVEREFERENCE_HPP
#define SHARE_VM_METAPROGRAMMING_REMOVEREFERENCE_HPP
#include "memory/allocation.hpp"
// This metafunction returns for a type T either the underlying type behind
// the reference iff T is a reference type, or the same type T if T is not
// a reference type.
template <typename T> struct RemoveReference: AllStatic { typedef T type; };
template <typename T> struct RemoveReference<T&>: AllStatic { typedef T type; };
#endif // SHARE_VM_METAPROGRAMMING_REMOVEREFERENCE_HPP

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/conditional.hpp"
#include "metaprogramming/isSame.hpp"
#include "utilities/debug.hpp"
class ConditionalTest {
class A: AllStatic {};
class B: AllStatic {};
typedef Conditional<true, A, B>::type A_B_if_true;
static const bool A_B_if_true_is_A = IsSame<A_B_if_true, A>::value;
static const bool A_B_if_true_is_B = IsSame<A_B_if_true, B>::value;
STATIC_ASSERT(A_B_if_true_is_A);
STATIC_ASSERT(!A_B_if_true_is_B);
typedef Conditional<false, A, B>::type A_B_if_false;
static const bool A_B_if_false_is_A = IsSame<A_B_if_false, A>::value;
static const bool A_B_if_false_is_B = IsSame<A_B_if_false, B>::value;
STATIC_ASSERT(!A_B_if_false_is_A);
STATIC_ASSERT(A_B_if_false_is_B);
};

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/decay.hpp"
#include "metaprogramming/isSame.hpp"
#include "utilities/debug.hpp"
class TestDecay: AllStatic {
class A: AllStatic {};
typedef const volatile A cvA;
typedef const volatile A& cvAref;
typedef const volatile A* cvAptr;
typedef const volatile A* const volatile cvAptrcv;
typedef A& Aref;
typedef Decay<cvAref>::type rr_cvAref;
static const bool decay_cvAref_is_A = IsSame<rr_cvAref, A>::value;
STATIC_ASSERT(decay_cvAref_is_A);
typedef Decay<cvAptrcv>::type rr_cvAptrcv;
static const bool decay_cvAptrcv_is_cvAptr = IsSame<rr_cvAptrcv, cvAptr>::value;
STATIC_ASSERT(decay_cvAptrcv_is_cvAptr);
};

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/enableIf.hpp"
#include "utilities/debug.hpp"
class EnableIfTest {
class A: AllStatic {
public:
template <bool condition>
static typename EnableIf<condition, char>::type test();
template <bool condition>
static typename EnableIf<!condition, long>::type test();
};
static const bool A_test_true_is_char = sizeof(A::test<true>()) == sizeof(char);
STATIC_ASSERT(A_test_true_is_char);
static const bool A_test_false_is_long = sizeof(A::test<false>()) == sizeof(long);
STATIC_ASSERT(A_test_false_is_long);
};

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isConst.hpp"
#include "utilities/debug.hpp"
class IsConstTest {
class A: AllStatic {};
STATIC_ASSERT(!IsConst<volatile int>::value);
STATIC_ASSERT(IsConst<const volatile int>::value);
STATIC_ASSERT(IsConst<const int>::value);
STATIC_ASSERT(!IsConst<int>::value);
STATIC_ASSERT(!IsConst<volatile A>::value);
STATIC_ASSERT(IsConst<const A>::value);
STATIC_ASSERT(!IsConst<A>::value);
STATIC_ASSERT(!IsConst<const A*>::value);
STATIC_ASSERT(IsConst<A* const>::value);
STATIC_ASSERT(IsConst<const A* const>::value);
STATIC_ASSERT(IsConst<A* const volatile>::value);
};

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isFloatingPoint.hpp"
#include "utilities/debug.hpp"
class IsFloatingPointTest: AllStatic {
STATIC_ASSERT(IsFloatingPoint<float>::value);
STATIC_ASSERT(IsFloatingPoint<double>::value);
STATIC_ASSERT(IsFloatingPoint<long double>::value);
STATIC_ASSERT(IsFloatingPoint<double const>::value);
STATIC_ASSERT(!IsFloatingPoint<double&>::value);
STATIC_ASSERT(!IsFloatingPoint<int>::value);
STATIC_ASSERT(!IsFloatingPoint<unsigned int>::value);
STATIC_ASSERT(!IsFloatingPoint<signed int>::value);
class A: AllStatic {};
STATIC_ASSERT(!IsFloatingPoint<A>::value);
STATIC_ASSERT(!IsFloatingPoint<A*>::value);
};

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isIntegral.hpp"
#include "utilities/debug.hpp"
class IsIntegralTest: AllStatic {
class A: AllStatic {};
static const bool ii_voidptr = IsIntegral<void*>::value;
STATIC_ASSERT(!ii_voidptr);
static const bool ii_Aptr = IsIntegral<A*>::value;
STATIC_ASSERT(!ii_Aptr);
static const bool ii_cAptr = IsIntegral<const A*>::value;
STATIC_ASSERT(!ii_cAptr);
static const bool ii_vAptr = IsIntegral<volatile A*>::value;
STATIC_ASSERT(!ii_vAptr);
static const bool ii_Avptr = IsIntegral<A* volatile>::value;
STATIC_ASSERT(!ii_Avptr);
static const bool ii_intptrt = IsIntegral<intptr_t>::value;
STATIC_ASSERT(ii_intptrt);
static const bool ii_char = IsIntegral<char>::value;
STATIC_ASSERT(ii_char);
static const bool ii_cintptrt = IsIntegral<const intptr_t>::value;
STATIC_ASSERT(ii_cintptrt);
static const bool ii_vintptrt = IsIntegral<volatile intptr_t>::value;
STATIC_ASSERT(ii_vintptrt);
static const bool ii_cvintptrt = IsIntegral<const volatile intptr_t>::value;
STATIC_ASSERT(ii_cvintptrt);
};

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isPointer.hpp"
#include "utilities/debug.hpp"
class IsPointerTest: AllStatic {
class A: AllStatic {};
static const bool ip_voidptr = IsPointer<void*>::value;
STATIC_ASSERT(ip_voidptr);
static const bool ip_Aptr = IsPointer<A*>::value;
STATIC_ASSERT(ip_Aptr);
static const bool ip_cAptr = IsPointer<const A*>::value;
STATIC_ASSERT(ip_cAptr);
static const bool ip_vAptr = IsPointer<volatile A*>::value;
STATIC_ASSERT(ip_vAptr);
static const bool ip_Avptr = IsPointer<A* volatile>::value;
STATIC_ASSERT(ip_Avptr);
static const bool ip_intptrt = IsPointer<intptr_t>::value;
STATIC_ASSERT(!ip_intptrt);
static const bool ip_char = IsPointer<char>::value;
STATIC_ASSERT(!ip_char);
};

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isSame.hpp"
#include "utilities/debug.hpp"
class IsSameTest: AllStatic {
class A: AllStatic {};
class B: AllStatic {};
static const bool const_A_is_A = IsSame<const A, A>::value;
STATIC_ASSERT(!const_A_is_A);
static const bool volatile_A_is_A = IsSame<volatile A, A>::value;
STATIC_ASSERT(!volatile_A_is_A);
static const bool Aref_is_A = IsSame<A&, A>::value;
STATIC_ASSERT(!Aref_is_A);
static const bool Aptr_is_A = IsSame<A*, A>::value;
STATIC_ASSERT(!Aptr_is_A);
static const bool A_is_B = IsSame<A, B>::value;
STATIC_ASSERT(!A_is_B);
static const bool A_is_A = IsSame<A, A>::value;
STATIC_ASSERT(A_is_A);
};

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isSame.hpp"
#include "metaprogramming/isSigned.hpp"
#include "utilities/debug.hpp"
class IsSignedTest: AllStatic {
template <typename SignedType, typename UnsignedType>
class TestIntegers: AllStatic {
static const bool _signed_type_is_signed = IsSigned<SignedType>::value;
STATIC_ASSERT(_signed_type_is_signed);
static const bool _unsigned_type_is_unsigned = !IsSigned<UnsignedType>::value;
STATIC_ASSERT(_unsigned_type_is_unsigned);
static const bool _cvsigned_type_is_signed = IsSigned<const volatile SignedType>::value;
STATIC_ASSERT(_signed_type_is_signed);
static const bool _cvunsigned_type_is_unsigned = !IsSigned<const volatile UnsignedType>::value;
STATIC_ASSERT(_unsigned_type_is_unsigned);
};
const TestIntegers<int8_t, uint8_t> TestByte;
const TestIntegers<int16_t, uint16_t> TestShort;
const TestIntegers<int32_t, uint32_t> TestInt;
const TestIntegers<int64_t, uint64_t> TestLong;
};

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/isVolatile.hpp"
#include "utilities/debug.hpp"
class IsVolatileTest {
class A: AllStatic {};
STATIC_ASSERT(IsVolatile<volatile int>::value);
STATIC_ASSERT(IsVolatile<const volatile int>::value);
STATIC_ASSERT(!IsVolatile<const int>::value);
STATIC_ASSERT(!IsVolatile<int>::value);
STATIC_ASSERT(IsVolatile<volatile A>::value);
STATIC_ASSERT(!IsVolatile<const A>::value);
STATIC_ASSERT(!IsVolatile<A>::value);
STATIC_ASSERT(!IsVolatile<volatile A*>::value);
STATIC_ASSERT(IsVolatile<A* volatile>::value);
STATIC_ASSERT(IsVolatile<volatile A* volatile>::value);
STATIC_ASSERT(IsVolatile<A* const volatile>::value);
};

View File

@ -0,0 +1,75 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/removeCV.hpp"
#include "metaprogramming/isSame.hpp"
#include "utilities/debug.hpp"
class RemoveCVTest {
class A: AllStatic {};
typedef const A cA;
typedef volatile A vA;
typedef const volatile A cvA;
typedef A* Aptr;
typedef const A* cAptr;
typedef A* const Aptrc;
typedef const A* const cAptrc;
typedef A& Aref;
typedef const A& cAref;
typedef RemoveCV<A>::type rcv_A;
static const bool rcv_A_is_A = IsSame<rcv_A, A>::value;
STATIC_ASSERT(rcv_A_is_A);
typedef RemoveCV<cA>::type rcv_cA;
static const bool rcv_cA_is_A = IsSame<rcv_cA, A>::value;
STATIC_ASSERT(rcv_cA_is_A);
typedef RemoveCV<vA>::type rcv_vA;
static const bool rcv_vA_is_A = IsSame<rcv_vA, A>::value;
STATIC_ASSERT(rcv_vA_is_A);
typedef RemoveCV<cvA>::type rcv_cvA;
static const bool rcv_cvA_is_A = IsSame<rcv_cvA, A>::value;
STATIC_ASSERT(rcv_cvA_is_A);
typedef RemoveCV<cAptr>::type rcv_cAptr;
static const bool rcv_cAptr_is_cAptr = IsSame<rcv_cAptr, cAptr>::value;
STATIC_ASSERT(rcv_cAptr_is_cAptr);
typedef RemoveCV<Aptrc>::type rcv_Aptrc;
static const bool rcv_Aptrc_is_Aptr = IsSame<rcv_Aptrc, Aptr>::value;
STATIC_ASSERT(rcv_Aptrc_is_Aptr);
typedef RemoveCV<cAptrc>::type rcv_cAptrc;
static const bool rcv_cAptrc_is_cAptr = IsSame<rcv_cAptrc, cAptr>::value;
STATIC_ASSERT(rcv_cAptrc_is_cAptr);
typedef RemoveCV<cAref>::type rcv_cAref;
static const bool rcv_cAref_is_cAref = IsSame<rcv_cAref, cAref>::value;
STATIC_ASSERT(rcv_cAref_is_cAref);
};

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/removePointer.hpp"
#include "metaprogramming/isSame.hpp"
#include "utilities/debug.hpp"
class RemovePointerTest {
class A: AllStatic {};
typedef const volatile A cvA;
typedef const volatile A& cvAref;
typedef const volatile A* const volatile cvAptrcv;
typedef RemovePointer<cvAref>::type rp_cvAref;
static const bool rp_cvAref_is_cvAref = IsSame<rp_cvAref, cvAref>::value;
STATIC_ASSERT(rp_cvAref_is_cvAref);
typedef RemovePointer<cvAptrcv>::type rp_cvAptrcv;
static const bool rp_cvAptrcv_is_cvAptrcv = IsSame<rp_cvAptrcv, cvA>::value;
STATIC_ASSERT(rp_cvAptrcv_is_cvAptrcv);
};

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "metaprogramming/removeReference.hpp"
#include "metaprogramming/isSame.hpp"
#include "utilities/debug.hpp"
class RemoveReferenceTest {
class A: AllStatic {};
typedef const volatile A cvA;
typedef const volatile A& cvAref;
typedef const volatile A* const volatile cvAptrcv;
typedef RemoveReference<cvAref>::type rr_cvAref;
static const bool rr_cvAref_is_cvAref = IsSame<rr_cvAref, cvA>::value;
STATIC_ASSERT(rr_cvAref_is_cvAref);
typedef RemoveReference<cvAptrcv>::type rr_cvAptrcv;
static const bool rr_cvAptrcv_is_cvAptrcv = IsSame<rr_cvAptrcv, cvAptrcv>::value;
STATIC_ASSERT(rr_cvAptrcv_is_cvAptrcv);
};