aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/pointer_holder.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2010-09-24 21:09:22 +0200
committerJay Berkenbilt <ejb@ql.org>2010-09-24 21:09:22 +0200
commitaa035961b38b6f01090e6f6a2ee4c9b9fb5041e8 (patch)
tree9fbdf139ac83bfe5231a8fc501a2408f912b216d /libtests/pointer_holder.cc
parent047bcfcaa605d8a3433bea27a1e82dc0067822c9 (diff)
downloadqpdf-aa035961b38b6f01090e6f6a2ee4c9b9fb5041e8.tar.zst
add * and -> operators
git-svn-id: svn+q:///qpdf/trunk@1029 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libtests/pointer_holder.cc')
-rw-r--r--libtests/pointer_holder.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc
index 173a8266..c255df5a 100644
--- a/libtests/pointer_holder.cc
+++ b/libtests/pointer_holder.cc
@@ -12,6 +12,7 @@ class Object
Object();
~Object();
void hello();
+ void hello() const;
private:
static int next_id;
@@ -38,8 +39,21 @@ Object::hello()
std::cout << "calling Object::hello for " << this->id << std::endl;
}
+void
+Object::hello() const
+{
+ std::cout << "calling Object::hello const for " << this->id << std::endl;
+}
+
typedef PointerHolder<Object> ObjectHolder;
+void callHello(ObjectHolder const& oh)
+{
+ oh.getPointer()->hello();
+ oh->hello();
+ (*oh).hello();
+}
+
int main(int argc, char* argv[])
{
std::list<ObjectHolder> ol1;
@@ -74,6 +88,9 @@ int main(int argc, char* argv[])
}
ol1.front().getPointer()->hello();
+ ol1.front()->hello();
+ (*ol1.front()).hello();
+ callHello(ol1.front());
ol1.pop_front();
std::cout << "goodbye" << std::endl;
return 0;