Skip to content
Snippets Groups Projects
Commit 1fa3c501 authored by Oliver Sander's avatar Oliver Sander
Browse files

replace SmartPointer by shared_ptr

[[Imported from SVN: r5631]]
parent a6c0f71a
Branches
Tags
No related merge requests found
......@@ -7,7 +7,7 @@
#include <cassert>
#include <vector>
#include "smartpointer.hh"
#include "shared_ptr.hh"
#include "array.hh"
#include "iteratorfacades.hh"
......@@ -199,7 +199,7 @@ namespace Dune
/**
* @brief The allocators for the fixed array.
*/
typedef typename A::template rebind<SmartPointer<array<MemberType,chunkSize_> > >::other
typedef typename A::template rebind<shared_ptr<array<MemberType,chunkSize_> > >::other
SmartPointerAllocator;
/**
......@@ -209,7 +209,7 @@ namespace Dune
friend class ConstArrayListIterator<T,N,A>;
/** @brief the data chunks of our list. */
std::vector<SmartPointer<array<MemberType,chunkSize_> >,
std::vector<shared_ptr<array<MemberType,chunkSize_> >,
SmartPointerAllocator> chunks_;
/** @brief The current data capacity. */
size_type capacity_;
......@@ -491,7 +491,7 @@ namespace Dune
size_t index=start_+size_;
if(index==capacity_)
{
chunks_.push_back(SmartPointer<array<MemberType,chunkSize_> >());
chunks_.push_back(shared_ptr<array<MemberType,chunkSize_> >());
capacity_ += chunkSize_;
}
elementAt(index)=entry;
......@@ -557,7 +557,7 @@ namespace Dune
// Number of chunks with entries in it;
size_t chunks = ((start_%chunkSize_ + size_)/chunkSize_ );
typedef typename std::vector<SmartPointer<array<MemberType,
typedef typename std::vector<shared_ptr<array<MemberType,
chunkSize_> > >::iterator iterator;
// Copy chunks to the left.
......
......@@ -11,7 +11,7 @@
#include "exceptions.hh"
#include "collectivecommunication.hh"
#include "binaryfunctions.hh"
#include "smartpointer.hh"
#include "shared_ptr.hh"
#if HAVE_MPI
// MPI header
......@@ -34,7 +34,7 @@ namespace Dune
{
if (type.operator->()==0)
{
type = SmartPointer<MPI_Datatype>(new MPI_Datatype);
type = shared_ptr<MPI_Datatype>(new MPI_Datatype);
MPI_Type_contiguous(sizeof(T),MPI_BYTE,type.operator->());
MPI_Type_commit(type.operator->());
}
......@@ -43,11 +43,11 @@ namespace Dune
private:
Generic_MPI_Datatype () {}
Generic_MPI_Datatype (const Generic_MPI_Datatype& ) {}
static SmartPointer<MPI_Datatype> type;
static shared_ptr<MPI_Datatype> type;
};
template<typename T>
SmartPointer<MPI_Datatype> Generic_MPI_Datatype<T>::type = SmartPointer<MPI_Datatype>(0);
shared_ptr<MPI_Datatype> Generic_MPI_Datatype<T>::type = shared_ptr<MPI_Datatype>(0);
// A Macro for defining traits for the primitive data types
#define ComposeMPITraits(p,m) \
......@@ -88,7 +88,7 @@ namespace Dune
{
if (op.operator->()==0)
{
op = SmartPointer<MPI_Op>(new MPI_Op);
op = shared_ptr<MPI_Op>(new MPI_Op);
MPI_Op_create((void (*)(void*, void*, int*, MPI_Datatype*))&operation,true,op.operator->());
}
return *op;
......@@ -106,12 +106,12 @@ namespace Dune
}
Generic_MPI_Op () {}
Generic_MPI_Op (const Generic_MPI_Op& ) {}
static SmartPointer<MPI_Op> op;
static shared_ptr<MPI_Op> op;
};
template<typename Type, typename BinaryFunction>
SmartPointer<MPI_Op> Generic_MPI_Op<Type,BinaryFunction>::op = SmartPointer<MPI_Op>(0);
shared_ptr<MPI_Op> Generic_MPI_Op<Type,BinaryFunction>::op = shared_ptr<MPI_Op>(0);
#define ComposeMPIOp(type,func,op) \
template<> \
......
......@@ -5,7 +5,7 @@
#include "config.h"
#endif
#include <dune/common/smartpointer.hh>
#include <dune/common/shared_ptr.hh>
#include <iostream>
#include <vector>
#include <cstdlib>
......@@ -14,9 +14,9 @@ int main(){
using namespace Dune;
int ret=0;
{
SmartPointer<double> b;
shared_ptr<double> b;
{
SmartPointer<double> d(b);
shared_ptr<double> d(b);
*b = 7;
}
if(b.count()!=1) {
......@@ -25,7 +25,7 @@ int main(){
ret=1;
}
{
SmartPointer<double> c(b);
shared_ptr<double> c(b);
if(*b!=*c) {
std::cerr<<"References do not match! "<<__LINE__<<":"<<
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment