Commit d6ea557c authored by Christoph Grüninger's avatar Christoph Grüninger

Merge branch 'type_traits' into 'master'

FS#1512 Replace type traits by their standard versions

See core/dune-common!27 for more information.

See merge request !2
parents 864931d9 3e428657
......@@ -82,7 +82,7 @@ namespace Dune {
template<class FiniteElement>
struct FiniteElementInterfaceSwitch<
FiniteElement,
typename enable_if<Std::to_true_type<typename FiniteElement::Traits::
typename std::enable_if<Std::to_true_type<typename FiniteElement::Traits::
LocalBasisType>::value>::type
>
{
......@@ -173,9 +173,9 @@ namespace Dune {
//! Switch for uniform treatment of local and global basis classes
template<class Basis>
struct BasisInterfaceSwitch<Basis,
typename enable_if<
typename std::enable_if<
Std::to_true_type<
integral_constant<
std::integral_constant<
std::size_t,
Basis::Traits::dimDomain
>
......
......@@ -66,7 +66,7 @@ namespace Dune {
static_assert(LocalBasis::Traits::dimRange == 1,
"ScalarLocalToGlobalBasisAdaptor can only wrap a "
"scalar local basis.");
static_assert((is_same<typename LocalBasis::Traits::DomainFieldType,
static_assert((std::is_same<typename LocalBasis::Traits::DomainFieldType,
typename Geometry::ctype>::value),
"ScalarLocalToGlobalBasisAdaptor: LocalBasis must use "
"the same ctype as Geometry");
......
......@@ -92,7 +92,7 @@ namespace Dune
* This is the VirtualFunction interface class if FE implements the virtual
* interface and Function base class otherwise.
*/
typedef typename conditional<IsBaseOf<Interface, Implementation>::value, VirtualFunctionBase, FunctionBase>::type type;
typedef typename std::conditional<std::is_base_of<Interface, Implementation>::value, VirtualFunctionBase, FunctionBase>::type type;
};
......
......@@ -46,7 +46,7 @@ namespace Dune
static Imp* clone(const Imp& imp)
{
return LocalFiniteElementCloneFactoryHelper<Imp, IsBaseOf<Interface, Imp>::value>::clone(imp);
return LocalFiniteElementCloneFactoryHelper<Imp, std::is_base_of<Interface, Imp>::value>::clone(imp);
}
static Imp* create()
......
......@@ -46,7 +46,7 @@ namespace Dune
{
if (order == 0 || !Object::template supports<T>(order))
return 0;
typedef typename remove_const<Object>::type LagrangeCoefficients;
typedef typename std::remove_const<Object>::type LagrangeCoefficients;
LagrangeCoefficients *object = new LagrangeCoefficients(order);
if ( !object->template build<T>() )
{
......
......@@ -22,12 +22,12 @@ namespace Dune
template<class Geometry, class RF>
class Q2FiniteElementFactory :
public ScalarLocalToGlobalFiniteElementAdaptorFactory<
typename conditional<Geometry::mydimension == 1,
typename std::conditional<Geometry::mydimension == 1,
PkLocalFiniteElement<typename Geometry::ctype, RF, 1, 2>,
QkLocalFiniteElement<typename Geometry::ctype, RF, Geometry::mydimension, 2> >::type,
Geometry>
{
typedef typename conditional<Geometry::mydimension == 1,
typedef typename std::conditional<Geometry::mydimension == 1,
PkLocalFiniteElement<typename Geometry::ctype, RF, 1, 2>,
QkLocalFiniteElement<typename Geometry::ctype, RF, Geometry::mydimension, 2> >::type LFE;
typedef ScalarLocalToGlobalFiniteElementAdaptorFactory<LFE, Geometry> Base;
......
......@@ -405,7 +405,7 @@ namespace Dune
typedef RaviartThomasL2InterpolationFactoryTraits<dim,Field> Traits;
typedef RTL2InterpolationBuilder<dim,Field> Builder;
typedef typename Traits::Object Object;
typedef typename remove_const<Object>::type NonConstObject;
typedef typename std::remove_const<Object>::type NonConstObject;
template <class Topology>
static typename Traits::Object *createObject( const typename Traits::Key &key )
{
......
......@@ -49,8 +49,8 @@ namespace Dune
{
RTVecMatrix<Topology,Field> vecMatrix(order);
typename Traits::MBasis *mbasis = Traits::MBasisFactory::template create<Topology>(order+1);
typename remove_const<Object>::type *tmBasis =
new typename remove_const<Object>::type(*mbasis);
typename std::remove_const<Object>::type *tmBasis =
new typename std::remove_const<Object>::type(*mbasis);
tmBasis->fill(vecMatrix);
return tmBasis;
}
......
......@@ -304,7 +304,7 @@ namespace Dune
for (int r1=0; r1<dimR; ++r1)
{
unsigned int b = 0;
apply<Field>(integral_constant<int,deriv>(),r1,x,block,b,vecIter);
apply<Field>(std::integral_constant<int,deriv>(),r1,x,block,b,vecIter);
}
}
}
......@@ -313,14 +313,14 @@ namespace Dune
const Block &block,unsigned int &b,
VecIter &vecIter) const
{
apply<Field>(integral_constant<int,deriv-1>(),r1,x,block,b,vecIter);
apply<Field>(std::integral_constant<int,deriv-1>(),r1,x,block,b,vecIter);
unsigned int bStart = b;
unsigned int bEnd = b+LFETensor<Field,Domain::dimension,deriv>::size;
apply<Field>(r1,x,block,bStart,bEnd,vecIter);
b=bEnd;
}
template <class Field, class Domain, class Block,class VecIter>
void apply(const integral_constant<int,0>&, int r1, const Domain &x,
void apply(const std::integral_constant<int,0>&, int r1, const Domain &x,
const Block &block,unsigned int &b,
VecIter &vecIter) const
{
......
......@@ -264,27 +264,27 @@ namespace Dune
const Dune::FieldVector<LFETensor<F,dimD,dorder>,dimR> &tensor() const
{
// use integral_constant<int,...> here to stay compatible with Int2Type
const integral_constant<int,dorder> a = {};
const std::integral_constant<int,dorder> a = {};
return tensor(a);
}
template <unsigned int dorder>
Dune::FieldVector<LFETensor<F,dimD,dorder>,dimR> &tensor()
{
// use integral_constant<int,...> here to stay compatible with Int2Type
return tensor(integral_constant<int,dorder>());
return tensor(std::integral_constant<int,dorder>());
}
template <unsigned int dorder>
const Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR> &block() const
{
// use integral_constant<int,...> here to stay compatible with Int2Type
const integral_constant<int,dorder> a = {};
const std::integral_constant<int,dorder> a = {};
return reinterpret_cast<const Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR>&>(tensor(a));
}
template <unsigned int dorder>
Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR> &block()
{
// use integral_constant<int,...> here to stay compatible with Int2Type
const integral_constant<int,dorder> a = {};
const std::integral_constant<int,dorder> a = {};
return reinterpret_cast<Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR>&>(tensor(a));
}
ThisLFETensor &operator[](int r) {
......@@ -317,23 +317,23 @@ namespace Dune
template <int dorder>
const Dune::FieldVector<LFETensor<F,dimD,dorder>,dimR> &
tensor(const integral_constant<int,dorder> &dorderVar) const
tensor(const std::integral_constant<int,dorder> &dorderVar) const
{
return Base::tensor(dorderVar);
}
const Dune::FieldVector<LFETensor<F,dimD,deriv>,dimR> &
tensor(const integral_constant<int,deriv> &dorderVar) const
tensor(const std::integral_constant<int,deriv> &dorderVar) const
{
return tensor_;
}
template <int dorder>
Dune::FieldVector<LFETensor<F,dimD,dorder>,dimR> &
tensor(const integral_constant<int,dorder> &dorderVar)
tensor(const std::integral_constant<int,dorder> &dorderVar)
{
return Base::tensor(dorderVar);
}
Dune::FieldVector<LFETensor<F,dimD,deriv>,dimR> &
tensor(const integral_constant<int,deriv> &dorderVar)
tensor(const std::integral_constant<int,deriv> &dorderVar)
{
return tensor_;
}
......@@ -440,25 +440,25 @@ namespace Dune
const Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR> &block() const
{
// use integral_constant<int,...> here to stay compatible with Int2Type
const integral_constant<int,dorder> a = {};
const std::integral_constant<int,dorder> a = {};
return reinterpret_cast<const Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR>&>(tensor(a));
}
template <unsigned int dorder>
Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR> &block()
{
// use integral_constant<int,...> here to stay compatible with Int2Type
const integral_constant<int,dorder> a = {};
const std::integral_constant<int,dorder> a = {};
return reinterpret_cast<Dune::FieldVector<F,LFETensor<F,dimD,dorder>::size*dimR>&>(tensor(a));
}
protected:
const Dune::FieldVector<LFETensor<F,dimD,0>,dimR> &
tensor(const integral_constant<int,0> &dorderVar) const
tensor(const std::integral_constant<int,0> &dorderVar) const
{
return tensor_;
}
Dune::FieldVector<LFETensor<F,dimD,0>,dimR> &
tensor(const integral_constant<int,0> &dorderVar)
tensor(const std::integral_constant<int,0> &dorderVar)
{
return tensor_;
}
......
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