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 \
- $(INCLUDE) -Ddeal_II_dimension=$(deal_II_dimension)
-
+include $D/deal.II/Make.global_options
%.go : %.cc
@echo ============================ Compiling with debugging information: $<
vpath %.a: $D/lac/lib
vpath %.a: $D/deal.II/lib
-ifeq ($(shell uname),Linux)
-CXX = /home/wolf/bin/gcc/bin/c++
-endif
-
-
test: run-reference run-logtest run-tensor
$(CXX) $(CXXFLAGS) -o $@ $^ $D/base/lib/libbase.g.a
run-reference: reference
- ./reference
+ -./reference
logtest: logtest.go
$(CXX) $(CXXFLAGS) -o $@ $^ $D/base/lib/libbase.g.a
run-logtest: logtest
- ./logtest
+ -./logtest
tensor: tensor.go
$(CXX) $(CXXFLAGS) -o $@ $^ $D/base/lib/libbase.g.a
run-tensor: tensor
- ./tensor
+ -./tensor
clean:
class Test : public Subscriptor
{
+ const char* name;
public:
+ Test(const char* n) :
+ name(n)
+ {
+ cout << "Construct " << name << endl;
+ }
+ ~Test()
+ {
+ cout << "Destruct " << name << endl;
+ }
void f()
{
cout << "mutable" << endl;
main()
{
- Test a;
- const Test b;
+ Test a("A");
+ const Test b("B");
SmartPointer<Test> r=&a;
SmartPointer<const Test> s=&a;
// SmartPointer<Test> t=&b; // this one should not work
SmartPointer<Test> t=const_cast<Test*>(&b);
SmartPointer<const Test> u=&b;
+
+ cout << "a ";
a.f(); // should print "mutable", since #a# is not const
+ cout << "b ";
b.f(); // should print "const", since #b# is const
+ cout << "r ";
r->f(); // should print "mutable", since it points to the non-const #a#
- s->f(); // should print "const", since it points to the non-const #a#
+ cout << "s ";
+ s->f(); // should print "const", since it points to the const #b#
// but we made it const
+ cout << "t ";
t->f(); // should print "mutable", since #b# is const, but
// we casted the constness away
+ cout << "u ";
u->f(); // should print "const" since #b# is const
+ // Now try if subscriptor works
+ {
+ Test c("C");
+ r = &c;
+ Test d("D");
+ r = &d;
+ }
}
+
+void abort()
+{}