Commit d7ac0330 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

use value template instead of ::value

parent de0b3746
......@@ -73,7 +73,7 @@ namespace AMDiS
/// Constructor for rowBasis == colBasis
template <class RB_ = RB, class CB_ = CB,
REQUIRES(std::is_same<RB_,CB_>::value)>
REQUIRES(std::is_same_v<RB_,CB_>)>
explicit BiLinearForm(std::shared_ptr<RB> const& rowBasis)
: BiLinearForm(rowBasis, rowBasis)
{}
......
......@@ -215,7 +215,7 @@ template <class Traits>
void ProblemStat<Traits>::createGlobalBasisImpl(std::true_type)
{
assert( bool(grid_) );
static_assert(std::is_same<GridView, typename Grid::LeafGridView>::value, "");
static_assert(std::is_same_v<GridView, typename Grid::LeafGridView>, "");
auto basis = Traits::create(name_, grid_->leafGridView());
globalBasis_ = std::make_shared<GlobalBasis>(std::move(basis));
}
......
......@@ -25,7 +25,7 @@ namespace AMDiS
{
/// Access the column entry `col` of the row `row_` of this accessor.
/// @{
template <class V = Vector, std::enable_if_t<not std::is_const<V>::value,int> = 0>
template <class V = Vector, std::enable_if_t<not std::is_const_v<V>,int> = 0>
reference operator[](size_type col)
{
return (*vector_)[row_*cols_ + col];
......
......@@ -92,6 +92,6 @@ namespace AMDiS
using IsEqual = Impl::IsEqualImpl<T,values...>;
template <class T, class... Ts>
using is_one_of = or_t<std::is_same<T, Ts>::value...>;
using is_one_of = or_t<std::is_same_v<T, Ts>...>;
} // end namespace AMDiS
......@@ -59,7 +59,7 @@ namespace Dune
{
// specialization for float arguments due to ambiguity
template <class T,
std::enable_if_t<not std::is_integral<T>::value && std::is_arithmetic<T>::value, int> = 0>
std::enable_if_t<not std::is_integral_v<T> && std::is_arithmetic_v<T>, int> = 0>
inline Float128 pow(const Float128& x, const T& p)
{
return powq(float128_t(x), float128_t(p));
......
......@@ -33,7 +33,7 @@ namespace AMDiS
template <class T>
std::shared_ptr<T> wrap_or_share(T* t)
{
static_assert(not std::is_pointer<T*>::value,
static_assert(not std::is_pointer_v<T*>,
"Raw pointers must be wrapped into smart pointers or references to clarify ownership");
}
......
......@@ -71,7 +71,7 @@ namespace AMDiS
// Arithmetic types have size 1 otherwise size is 0
template <class T>
static constexpr auto eval(T const&, Dune::PriorityTag<0>)
-> decltype(std::integral_constant<std::size_t, (std::is_arithmetic<T>::value ? 1 : 0)>{})
-> decltype(std::integral_constant<std::size_t, (std::is_arithmetic_v<T> ? 1 : 0)>{})
{
return {};
}
......@@ -154,7 +154,7 @@ namespace AMDiS
// Fallback-size is 1 for arithmetic types or 0
template <class T>
static constexpr auto eval(T const&, Dune::PriorityTag<0>)
-> decltype(std::integral_constant<std::size_t, (std::is_arithmetic<T>::value ? 1 : 0)>{})
-> decltype(std::integral_constant<std::size_t, (std::is_arithmetic_v<T> ? 1 : 0)>{})
{
return {};
}
......@@ -236,7 +236,7 @@ namespace AMDiS
// Fallback-size is 0
template <class T>
static constexpr auto eval(T const&, Dune::PriorityTag<0>)
-> decltype(std::integral_constant<std::size_t, (std::is_arithmetic<T>::value ? 1 : 0)>{})
-> decltype(std::integral_constant<std::size_t, (std::is_arithmetic_v<T> ? 1 : 0)>{})
{
return {};
}
......
......@@ -49,7 +49,7 @@ namespace AMDiS
}
template <class M = Matrix,
std::enable_if_t<not std::is_const<M>::value, int> = 0>
std::enable_if_t<not std::is_const_v<M>, int> = 0>
MutableRowProxy operator[](size_type row)
{
return MutableRowProxy{&matrix_, row};
......
......@@ -128,7 +128,7 @@ namespace AMDiS
template <bool... b>
using enable_if_all_t
= std::enable_if_t<std::is_same<std::integer_sequence<bool,true,b...>,
std::integer_sequence<bool,b...,true>>::value>;
= std::enable_if_t<std::is_same_v<std::integer_sequence<bool,true,b...>,
std::integer_sequence<bool,b...,true>>>;
} // end namespace AMDiS
......@@ -21,7 +21,7 @@ namespace AMDiS
using ValueCategory_t = typename ValueCategory<remove_cvref_t<T>>::type;
template <class T>
struct ValueCategory<T, std::enable_if_t< std::is_arithmetic<T>::value >>
struct ValueCategory<T, std::enable_if_t< std::is_arithmetic_v<T> >>
{
using type = tag::scalar;
};
......@@ -60,13 +60,13 @@ namespace AMDiS
namespace Category
{
template <class T>
constexpr bool Scalar = std::is_same<ValueCategory_t<T>, tag::scalar>::value;
constexpr bool Scalar = std::is_same_v<ValueCategory_t<T>, tag::scalar>;
template <class T>
constexpr bool Vector = std::is_same<ValueCategory_t<T>, tag::vector>::value;
constexpr bool Vector = std::is_same_v<ValueCategory_t<T>, tag::vector>;
template <class T>
constexpr bool Matrix = std::is_same<ValueCategory_t<T>, tag::matrix>::value;
constexpr bool Matrix = std::is_same_v<ValueCategory_t<T>, tag::matrix>;
} // end namespace Category
......
......@@ -22,7 +22,7 @@
namespace AMDiS {
namespace Concepts {
template <class T>
constexpr bool RawPointer = std::is_pointer<std::decay_t<T>>::value;
constexpr bool RawPointer = std::is_pointer_v<std::decay_t<T>>;
}
namespace Mpi
......
......@@ -45,7 +45,7 @@ namespace Mpi
struct is_mpi_type<std::pair<T1,T2>> : std::integral_constant<bool,
is_mpi_type<T1>::value &&
is_mpi_type<T2>::value &&
std::is_standard_layout<std::pair<T1,T2>>::value
std::is_standard_layout_v<std::pair<T1,T2>>
>
{};
......
......@@ -32,7 +32,7 @@ namespace AMDiS
auto localView = basis.localView();
// set vector to zero at subtree
if (! std::is_same<Assign, Assigner::assign>::value) {
if (!std::is_same_v<Assign, Assigner::assign>) {
for (const auto& e : elements(basis.gridView(), typename BackendTraits<B>::PartitionSet{}))
{
localView.bind(e);
......@@ -130,21 +130,21 @@ namespace AMDiS
template <class B, class Vec, class GF, class TP, class C, class BV>
void interpolate(B const& basis, Vec& vec, GF const& gf, TP&& tp, C&& c, BV const& bitVec)
{
static_assert(not std::is_same<BV, tag::defaulted>::value, "");
static_assert(not std::is_same_v<BV, tag::defaulted>, "");
AMDiS::interpolate(basis, vec, gf, FWD(tp), FWD(c), bitVec, tag::defaulted{});
}
template <class B, class Vec, class GF, class TP, class C>
void interpolate(B const& basis, Vec& vec, GF const& gf, TP&& tp, C& counter)
{
static_assert(not std::is_same<C, tag::defaulted>::value, "");
static_assert(not std::is_same_v<C, tag::defaulted>, "");
AMDiS::interpolate(basis, vec, gf, FWD(tp), counter, tag::defaulted{}, Assigner::plus_assign{});
}
template <class B, class Vec, class GF, class TreePath>
void interpolate(B const& basis, Vec& vec, GF const& gf, TreePath const& treePath)
{
static_assert(not std::is_same<TreePath, tag::defaulted>::value, "");
static_assert(not std::is_same_v<TreePath, tag::defaulted>, "");
AMDiS::interpolate(basis, vec, gf, treePath, tag::defaulted{}, tag::defaulted{}, Assigner::assign{});
}
......
......@@ -10,7 +10,7 @@ namespace AMDiS
{
/// The derivative of a localfunction as localfunction itself
template <class LocalFunction, class Type,
REQUIRES(std::is_convertible<tag::derivative_type, Type>::value),
REQUIRES(std::is_convertible_v<tag::derivative_type, Type>),
class = void_t<decltype(std::declval<LocalFunction>().makeDerivative(std::declval<Type>()))> >
auto derivative(LocalFunction const& lf, Type const& type)
{
......
......@@ -22,7 +22,7 @@ namespace AMDiS
template <class Traits>
struct CheckValidRange
{
static_assert(!std::is_same<typename Traits::Range, Dune::Functions::InvalidRange>::value, "Invalid Range.");
static_assert(!std::is_same_v<typename Traits::Range, Dune::Functions::InvalidRange>, "Invalid Range.");
};
}
......
......@@ -40,7 +40,7 @@ void DiscreteFunction<Coeff,GB,TP>::
auto&& gf = makeGridFunction(FWD(expr), basis.gridView());
if (std::is_same<Tag, tag::average>::value) {
if (std::is_same_v<Tag, tag::average>) {
VectorType_t<short,Coeff> counter(basis);
AMDiS::interpolate(basis, coefficients(), gf, treePath, counter);
......
......@@ -52,8 +52,8 @@ namespace AMDiS
private:
template <class Data,
REQUIRES(not std::is_same<ValueCategory_t<typename Data::Range>,tag::unknown>::value),
REQUIRES(std::is_arithmetic<typename Dune::FieldTraits<typename Data::Range>::field_type>::value)>
REQUIRES(not std::is_same_v<ValueCategory_t<typename Data::Range>,tag::unknown>),
REQUIRES(std::is_arithmetic_v<typename Dune::FieldTraits<typename Data::Range>::field_type>)>
std::unique_ptr<FileWriterInterface>
create_impl(std::string type, std::string prefix, Data const& data, Dune::PriorityTag<2>) const
{
......@@ -95,8 +95,8 @@ namespace AMDiS
// The value-category is unknown, like a composite/hierarchic vector or any unknown type.
template <class Data,
REQUIRES(std::is_same<ValueCategory_t<typename Data::Range>,tag::unknown>::value),
REQUIRES(std::is_arithmetic<typename Dune::FieldTraits<typename Data::Range>::field_type>::value)>
REQUIRES(std::is_same_v<ValueCategory_t<typename Data::Range>,tag::unknown>),
REQUIRES(std::is_arithmetic_v<typename Dune::FieldTraits<typename Data::Range>::field_type>)>
std::unique_ptr<FileWriterInterface>
create_impl(std::string type, std::string prefix, Data const& /*data*/, Dune::PriorityTag<1>) const
{
......
......@@ -78,7 +78,7 @@ namespace AMDiS
assert(r.size() == localMatrix.rows());
assert(c.size() == localMatrix.cols());
const bool optimized = std::is_same<RowLocalView,ColLocalView>::value
const bool optimized = std::is_same_v<RowLocalView,ColLocalView>
&& r.tree().treeIndex() == c.tree().treeIndex();
if (optimized)
......
......@@ -49,7 +49,7 @@ namespace AMDiS
};
template <class A>
using VectorStateOf_t = std::conditional_t<std::is_same<A,Assigner::plus_assign>::value,
using VectorStateOf_t = std::conditional_t<std::is_same_v<A,Assigner::plus_assign>,
std::integral_constant<VectorState, VectorState::add_values>,
std::integral_constant<VectorState, VectorState::insert_values>>;
......
......@@ -70,7 +70,7 @@ namespace AMDiS
}
template <class Smoother, class LinOp, class Criterion, class SmootherArgs, class Comm,
REQUIRES(not std::is_same<Comm, Dune::Amg::SequentialInformation>::value)>
REQUIRES(not std::is_same_v<Comm, Dune::Amg::SequentialInformation>)>
static std::unique_ptr<PrecBase>
create(std::string, LinOp const&, Criterion const&, SmootherArgs const&, Comm const&)
{
......@@ -269,7 +269,7 @@ namespace AMDiS
using SolverCategory = typename Dune::SolverCategory::Category;
static const bool is_arithmetic = std::is_arithmetic<typename Dune::FieldTraits<M>::field_type>::value;
static const bool is_arithmetic = std::is_arithmetic_v<typename Dune::FieldTraits<M>::field_type>;
using Norm = std::conditional_t<is_arithmetic, Dune::Amg::FirstDiagonal, Dune::Amg::RowSum>;
using SymCriterion = Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<M,Norm>>;
......@@ -298,7 +298,7 @@ namespace AMDiS
private:
template <class Comm,
REQUIRES(not std::is_same<Comm, Dune::Amg::SequentialInformation>::value)>
REQUIRES(not std::is_same_v<Comm, Dune::Amg::SequentialInformation>)>
std::unique_ptr<Interface>
createImpl1(SolverCategory cat, M const& mat, Comm const& comm) const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment