Skip to content
Snippets Groups Projects
Commit 615ce099 authored by Christian Engwer's avatar Christian Engwer
Browse files

Merge branch 'deprecate-alignmentof' into 'master'

Deprecate dune/common/alignment.hh

alignment.hh provides Dune::AlignmentOf<T>::value which is identical to std::alignment_of<T>::value.
This merge request replaces use of AlignmentOf with the shorter alignof() operator introduced in C++11 and deprecates the header.

See merge request !6
parents 737f92f2 b10375d4
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
#ifndef DUNE_ALIGNMENT_HH
#define DUNE_ALIGNMENT_HH
#warning The header dune/common/alignment.hh is deprecated. Use alignof(T) instead of Dune::AlignmentOf<T>::value.
#include <type_traits>
namespace Dune
......
......@@ -7,7 +7,6 @@
* \brief An stl-compliant pool allocator
*/
#include "alignment.hh"
#include "lcm.hh"
#include <typeinfo>
#include <iostream>
......@@ -124,7 +123,7 @@ namespace Dune
* @brief The alignment that suits both the MemberType and
* the Reference (i.e. their least common multiple).
*/
alignment = Lcm<AlignmentOf<MemberType>::value,AlignmentOf<Reference>::value>::value,
alignment = Lcm<alignof(MemberType), alignof(Reference)>::value,
/**
* @brief The aligned size of the type.
......
......@@ -5,7 +5,6 @@
#endif
#include <dune/common/poolallocator.hh>
#include <dune/common/alignment.hh>
#include <dune/common/fmatrix.hh>
using namespace Dune;
......@@ -108,7 +107,7 @@ int testPool()
int ret=0;
std::cout<<"Checking "<<typeid(T).name()<<" sizeof="<<sizeof(T)<<" with size "<< size<<
" alignment="<<AlignmentOf<T>::value<<std::endl;
" alignment="<< alignof(T) <<std::endl;
ret += testPoolMain<0,T>::test();
ret += testPoolMain<size,T>::test();
......@@ -157,7 +156,7 @@ int main(int, char **)
ret+=testPoolAllocator();
std::cout<<AlignmentOf<UnAligned>::value<<" "<<sizeof(UnAligned)<<std::endl;
std::cout<< alignof(UnAligned) <<" "<<sizeof(UnAligned)<<std::endl;
ret += testPool<UnAligned>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment