diff options
author | Murray Cumming <murrayc@usa.net> | 2003-01-22 22:03:14 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2003-01-22 22:03:14 +0000 |
commit | ec9e925aff2038a454e7b33ed3e4a88c7b4a946b (patch) | |
tree | 5081e3aaf6f10381e21bf65e3a350c71a0bc8158 /examples | |
parent | 4be1f990adb4028b17c869d2332b4736eea1fb99 (diff) | |
download | sigc++-ec9e925aff2038a454e7b33ed3e4a88c7b4a946b.tar.gz |
Added Andreas Rottman's example.
2003-01-22 Murray Cumming <murrayc@usa.net>
* Added Andreas Rottman's example.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 6 | ||||
-rw-r--r-- | examples/hello_world.cc | 28 |
2 files changed, 34 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..e1ac82f --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,6 @@ +LDADD = $(top_builddir)/sigc++/libsigc-2.0.la +AM_CPPFLAGS = -I$(top_srcdir) + +noinst_PROGRAMS = hello_world + +hello_world_SOURCES = hello_world.cc diff --git a/examples/hello_world.cc b/examples/hello_world.cc new file mode 100644 index 0000000..3febe35 --- /dev/null +++ b/examples/hello_world.cc @@ -0,0 +1,28 @@ +/* Copyright 2003, The libsigc++ Development Team + * + * Assigned to the public domain. Use as you wish without + * restriction. + */ + +#include <iostream> +#include <string> + +#include <sigc++/signal.h> +#include <sigc++/functors/ptr_fun.h> + +using namespace std; +using namespace sigc; + +void print(const string &str) +{ + cout << str; +} + +main() +{ + signal<void, const string&> printer; + + printer.connect(ptr_fun(&print)); + + printer("hello world\n"); +} |