]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test fuer SmartPointer
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 2 Sep 1998 22:11:26 +0000 (22:11 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 2 Sep 1998 22:11:26 +0000 (22:11 +0000)
git-svn-id: https://svn.dealii.org/trunk@548 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/Makefile [new file with mode: 0644]
tests/base/reference.cc [new file with mode: 0644]

diff --git a/tests/base/Makefile b/tests/base/Makefile
new file mode 100644 (file)
index 0000000..3ab82b4
--- /dev/null
@@ -0,0 +1,33 @@
+# $Id$
+#
+# Set root directory of DEAL distribution.
+# This is only one letter to make the rest MORE readable.
+
+D=../..
+
+CXX       = c++
+INCLUDE   = -I$D/deal.II/include -I$D/lac/include \
+            -I$D/base/include
+
+CXXFLAGS  = -DDEBUG -g -Wall -W -pedantic -Wconversion \
+            -Winline -Woverloaded-virtual -fno-rtti  \
+            $(INCLUDE) -Ddeal_II_dimension=$(deal_II_dimension)
+
+%.go : %.cc
+       @echo ============================ Compiling with debugging information:   $<
+       @$(CXX) $(CXXFLAGS) -c $< -o $@
+%.o : %.cc
+       @echo ============================ Compiling with optimization:   $<
+       @$(CXX) $(CXXFLAGS) -c $< -o $@
+
+
+vpath %.a: $D/base/lib
+vpath %.a: $D/lac/lib
+vpath %.a: $D/deal.II/lib
+
+ifeq ($(shell uname),Linux)
+CXX       = /home/wolf/bin/gcc/bin/c++
+endif
+
+reference: reference.go
+       $(CXX) -o $@ $^
\ No newline at end of file
diff --git a/tests/base/reference.cc b/tests/base/reference.cc
new file mode 100644 (file)
index 0000000..03c6925
--- /dev/null
@@ -0,0 +1,34 @@
+
+#include <iostream>
+#include <base/exceptions.h>
+#include <base/subscriptor.h>
+
+class Test : public Subscriptor
+{
+public:
+  void f()
+  {
+    cout << "mutable" << endl;
+  }
+  void f() const
+  {
+    cout << "const" << endl;
+  }
+};
+
+main()
+{
+  Test a;
+  const Test b;
+  SmartPointer<Test> r=&a;
+  const SmartPointer<Test> s=&a;
+  SmartPointer<Test> t=&b;
+  const SmartPointer<Test> u=&b;
+
+  a.f();
+  b.f();
+  r->f();
+  s->f();
+  t->f();
+  u->f();
+}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.