* This code supports pme_order <= 5.
*/
template <int Order>
- typename std::enable_if<Order == 4 || Order == 5, RVec>::type
+ std::enable_if_t<Order == 4 || Order == 5, RVec>
operator()(std::integral_constant<int, Order> order) const
{
const int norder = nn*order;
ArrayRef<char> charArrayRefFromArray(T *data, size_t size)
{
// Make a type like T, but without its possible const qualifier.
- using NonConstT = typename std::remove_const<T>::type;
+ using NonConstT = std::remove_const_t<T>;
return arrayRefFromArray<char>(reinterpret_cast<char *>(const_cast<NonConstT *>(data)), size * sizeof(T));
}
: begin_(std::move(o.begin_)), end_(std::move(o.end_)), paddedEnd_(std::move(o.paddedEnd_)) {}
//! Convenience overload constructor to make an ArrayRefWithPadding<const T> from a non-const one.
template<typename U,
- typename = typename std::enable_if<
+ typename = std::enable_if_t<
std::is_same<value_type,
- const typename std::remove_reference<U>::type::value_type>::value>::type>
+ const typename std::remove_reference_t<U>::value_type>::value> >
ArrayRefWithPadding(U &&o)
{
auto constArrayRefWithPadding = o.constArrayRefWithPadding();
}
template<bool c, typename T>
-using makeConstIf_t = typename std::conditional<c, const T, T>::type;
+using makeConstIf_t = std::conditional_t<c, const T, T>;
//! Helper struct for the case actually used in mdrun signalling
template <typename T>
// of pointers, the implementation will be different enough that the whole
// template class should have a separate partial specialization. We try to avoid
// accidental matching to pointers, but this assertion is a no-cost extra check.
- static_assert(!std::is_pointer<typename std::remove_cv<ValueType>::type>::value,
+ static_assert(!std::is_pointer < std::remove_cv_t < ValueType>>::value,
"BasicVector value type must not be a pointer.");
//! Constructs default (uninitialized) vector.
* the view itself, so a single begin that takes a const view suffices.
*/
template <class BasicMdspan>
-constexpr typename std::enable_if<BasicMdspan::is_always_contiguous(),
- typename BasicMdspan::pointer>::type
+constexpr std::enable_if_t<BasicMdspan::is_always_contiguous(),
+ typename BasicMdspan::pointer>
begin(const BasicMdspan &basicMdspan)
{
return basicMdspan.data();
* the view itself, so a single end that takes a const view suffices.
*/
template <class BasicMdspan>
-constexpr typename std::enable_if<BasicMdspan::is_always_contiguous(),
- typename BasicMdspan::pointer>::type
+constexpr std::enable_if_t<BasicMdspan::is_always_contiguous(),
+ typename BasicMdspan::pointer>
end(const BasicMdspan &basicMdspan)
{
return basicMdspan.data() + basicMdspan.mapping().required_span_size();
* \returns One-dimensional integer index.
*/
template<class ... Indices >
- typename std::enable_if<sizeof ... (Indices) == Extents::rank(), index_type>::type
+ std::enable_if_t<sizeof ... (Indices) == Extents::rank(), index_type>
constexpr operator()( Indices ... indices ) const noexcept
{ return offset( 0, 0, indices ... ); }
//! Exposes the type of stored element.
using element_type = typename accessor_type::element_type;
//! Expose the underlying type of the stored elements.
- using value_type = typename std::remove_cv<element_type>::type;
+ using value_type = std::remove_cv_t<element_type>;
//! Expose the type used for indexing.
using index_type = ptrdiff_t;
//! Expose type for index differences.
* \param[in] other mdspan-implementing container
*/
template<typename U,
- typename = typename std::enable_if<
- std::is_same<typename std::remove_reference<U>::type::view_type::element_type,
- ElementType>::value>::type>
+ typename = std::enable_if_t<
+ std::is_same<typename std::remove_reference_t<U>::view_type::element_type,
+ ElementType>::value> >
constexpr basic_mdspan(U &&other) : basic_mdspan(other.asView()) {}
/*! \brief Construct mdspan of const Elements from multidimensional arrays implemented with mdspan
*
* \param[in] other mdspan-implementing container
*/
template<typename U,
- typename = typename std::enable_if<
- std::is_same<typename std::remove_reference<U>::type::const_view_type::element_type,
- ElementType>::value>::type>
+ typename = std::enable_if_t<
+ std::is_same<typename std::remove_reference_t<U>::const_view_type::element_type,
+ ElementType>::value> >
constexpr basic_mdspan(const U &other) : basic_mdspan(other.asConstView()) {}
/*! \brief Brace operator to access multidimensional array element.
* \param[in] indices The multidimensional indices of the object.
* \returns reference to element at indices.
*/
template<class... IndexType >
- constexpr typename std::enable_if<sizeof ... (IndexType) == extents_type::rank(), reference>::type
+ constexpr std::enable_if_t<sizeof ... (IndexType) == extents_type::rank(), reference>
operator()( IndexType... indices) const noexcept
{ return acc_.access( ptr_, map_( indices ... ) ); }
/*! \brief Canonical bracket operator for one-dimensional arrays.
* \returns reference to element stored at position i
*/
template<class IndexType>
- constexpr typename std::enable_if<std::is_integral<IndexType>::value &&
- extents_type::rank() == 1, reference>::type
+ constexpr std::enable_if_t<std::is_integral<IndexType>::value &&
+ extents_type::rank() == 1, reference>
operator[]( const IndexType &i ) const noexcept
{ return acc_.access( ptr_, map_(i) ); }
/*! \brief Bracket operator for multi-dimensional arrays.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* 2) load(real*); template parameter is mandatory because otherwise ambiguity is
* created. The dependent type disables type deduction.
*/
-load(const typename std::enable_if<std::is_arithmetic<T>::value, T>::type *m)
+load(const std::enable_if_t<std::is_arithmetic<T>::value, T> *m)
{
return *m;
}
template<typename T>
static inline T
-loadU(const typename std::enable_if<std::is_arithmetic<T>::value, T>::type *m)
+loadU(const std::enable_if_t<std::is_arithmetic<T>::value, T> *m)
{
return *m;
}
class SimdReference
{
private:
- using non_const_T = typename std::remove_const<T>::type;
+ using non_const_T = std::remove_const_t<T>;
using pointer = typename SimdTraits<T>::type*;
public:
//! \brief Constructor
}
//! \copydoc ArrayRef::ArrayRef(U)
template<typename U,
- typename = typename std::enable_if<
- std::is_convertible<typename std::remove_reference<U>::type::pointer,
- pointer>::value>::type>
+ typename = std::enable_if_t<
+ std::is_convertible<typename std::remove_reference_t<U>::pointer,
+ pointer>::value> >
SimdArrayRef(U &&o) : begin_(reinterpret_cast<pointer>(o.data())),
end_(reinterpret_cast<pointer>(o.data()+o.size())) {}
//reinterpret_cast is only needed for const conversion of SimdArrayRef itself.
using ArrayRefType = TypeParam;
using PointerType = typename ArrayRefType::pointer;
using ValueType = typename ArrayRefType::value_type;
- using ElementType = typename std::remove_const<typename gmx::internal::SimdTraits<ValueType>::type>::type;
+ using ElementType = std::remove_const_t < typename gmx::internal::SimdTraits < ValueType>::type>;
static constexpr int width = gmx::internal::SimdTraits<ValueType>::width;
/*! \brief Run the same tests all the time
std::array<typename TestFixture::ElementType, TestFixture::width*3> a;
std::iota(a.begin(), a.end(), 0);
- ArrayRef<typename std::remove_const<typename TestFixture::ValueType>::type>
+ ArrayRef < std::remove_const_t < typename TestFixture::ValueType>>
ref(a.data(), a.data()+a.size());
typename TestFixture::ArrayRefType arrayRef(ref);
this->runReadOnlyTests(a.data(), 3, arrayRef);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* FUTURE: Can be removed with C++17 (is_always_equal)
*/
template<class T2, class A = AllocationPolicy,
- typename = typename std::enable_if<std::is_empty<A>::value>::type>
+ typename = std::enable_if_t<std::is_empty<A>::value> >
bool operator==(const Allocator<T2, AllocationPolicy> & /*unused*/) const { return true; }
/*! \brief Return true if two allocators are different
*
* \throws std::bad_alloc if out of memory.
*/
- template <typename T, typename = typename std::enable_if<!std::is_same<T, Any>::value>::type>
+ template <typename T, typename = std::enable_if_t<!std::is_same<T, Any>::value> >
explicit Any(T &&value)
- : content_(new Content<typename std::decay<T>::type>(std::forward<T>(value)))
+ : content_(new Content < std::decay_t < T>>(std::forward<T>(value)))
{
}
/*! \brief
* a container to a method that takes ArrayRef.
*/
template<typename U,
- typename = typename std::enable_if<
- std::is_convertible<typename std::remove_reference<U>::type::pointer,
- pointer>::value>::type>
+ typename = std::enable_if_t<
+ std::is_convertible<typename std::remove_reference_t<U>::pointer,
+ pointer>::value> >
ArrayRef(U &&o) : begin_(o.data()), end_(o.data()+o.size()) {}
/*! \brief
* Constructs a reference to a particular range.
* \see ArrayRef
*/
template <typename T>
-ArrayRef<typename std::conditional<std::is_const<T>::value,
- const typename T::value_type,
- typename T::value_type>::type>
+ArrayRef < std::conditional_t < std::is_const<T>::value,
+const typename T::value_type,
+typename T::value_type>>
makeArrayRef(T &c)
{
return c;
{
public:
//! Convenience alias
- using IntegerType = typename std::underlying_type<EnumType>::type;
+ using IntegerType = std::underlying_type_t<EnumType>;
/*! \name Iterator type traits
* Satisfies the requirements for STL forward iterator.
*/
template <class Exception, class Tag, class T>
inline
-typename std::enable_if<std::is_base_of<GromacsException, Exception>::value, Exception>::type
+std::enable_if_t<std::is_base_of<GromacsException, Exception>::value, Exception>
operator<<(Exception ex, const ExceptionInfo<Tag, T> &item)
{
ex.setInfo(item);
public:
typedef TypeParam ArrayRefType;
typedef typename ArrayRefType::value_type ValueType;
- typedef typename std::remove_const<ValueType>::type NonConstValueType;
+ typedef std::remove_const_t<ValueType> NonConstValueType;
/*! \brief Run the same tests all the time
*
}
template<bool c, typename T>
-using makeConstIf_t = typename std::conditional<c, const T, T>::type;
+using makeConstIf_t = std::conditional_t<c, const T, T>;
TYPED_TEST(ArrayRefTest, ConstructFromVectorWorks)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#define GMX_MPI_TEST(expectedRankCount) \
do { \
ASSERT_EQ(expectedRankCount, ::gmx::test::getNumberOfTestMpiRanks()); \
- typedef std::remove_reference<decltype(*this)>::type MyTestClass; \
+ using MyTestClass = std::remove_reference_t<decltype(*this)>; \
if (!::gmx::test::threadMpiTestRunner(std::bind(&MyTestClass::TestBody, this))) \
{ \
return; \