#include "Didasko_ConfigDefs.h"
#ifdef HAVE_MPI
#include "mpi.h"
#endif
#if defined(HAVE_DIDASKO_TEUCHOS)
#include "Teuchos_RCP.hpp"
class A {
public:
A() {}
virtual ~A(){}
virtual void f(){}
};
class B1 : virtual public A {};
class B2 : virtual public A {};
class C : public B1, public B2 {};
using namespace Teuchos;
int main(int argc, char* argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
RCP<A> a_null_ptr;
RCP<A> a_ptr = rcp(new A);
RCP<const A> ca_ptr = rcp(new A);
const RCP<A> a_cptr = rcp(new A);
const RCP<const A> ca_cptr = rcp(new A);
RCP<B1> b1_ptr = rcp(new B1);
RCP<A> a_ptr1 = b1_ptr;
RCP<const C> c_ptr = rcp(new C);
RCP<const B2> b2_ptr = c_ptr;
RCP<const A> ca_ptr1 = rcp_dynamic_cast<const A>(c_ptr);
RCP<const A> ca_ptr2 = rcp_static_cast<const A>(c_ptr);
RCP<B2> nc_b2_ptr = rcp_const_cast<B2>(b2_ptr);
RCP<A>
a_ptr2 = rcp(new A),
a_ptr3 = rcp(new A);
A *ra_ptr2 = new A,
*ra_ptr3 = new A;
a_ptr2 = rcp(ra_ptr3);
a_ptr3 = a_ptr1;
a_ptr2 = rcp(ra_ptr2);
a_ptr2->f();
ra_ptr2->f();
*a_ptr2 = *a_ptr3;
*ra_ptr2 = *ra_ptr3;
A* true_ptr = 0;
true_ptr = a_ptr1.get();
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
#else
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
#endif
puts("Please configure Didasko with:\n"
"--enable-teuchos");
#ifdef HAVE_MPI
MPI_Finalize();
#endif
return 0;
}
#endif