summaryrefslogtreecommitdiff
path: root/trunk/Lib/ruby/std_functors.i
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2010-06-02 20:53:17 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2010-06-02 20:53:17 +0000
commit2824b0cbb66e715490e1ef13250bd675d87b32d9 (patch)
treec3bc8d54c6d73f2b7ce08cac34172dbc9f5e5b95 /trunk/Lib/ruby/std_functors.i
parent289cfef4b4766ff266f3b1bdda8ca3a952e5a047 (diff)
downloadswig-2.0.0.tar.gz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-2.0.0@12089 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'trunk/Lib/ruby/std_functors.i')
-rw-r--r--trunk/Lib/ruby/std_functors.i29
1 files changed, 29 insertions, 0 deletions
diff --git a/trunk/Lib/ruby/std_functors.i b/trunk/Lib/ruby/std_functors.i
new file mode 100644
index 000000000..54ee97b56
--- /dev/null
+++ b/trunk/Lib/ruby/std_functors.i
@@ -0,0 +1,29 @@
+/**
+ * @file std_functors.i
+ * @date Sun May 6 00:44:33 2007
+ *
+ * @brief This file provides unary and binary functors for STL
+ * containers, that will invoke a Ruby proc or method to do
+ * their operation.
+ *
+ * You can use them in a swig file like:
+ *
+ * %include <std_set.i>
+ * %include <std_functors.i>
+ *
+ * %template< IntSet > std::set< int, swig::BinaryPredicate<int> >;
+ *
+ *
+ * which will then allow calling them from Ruby either like:
+ *
+ * # order of set is defined by C++ default
+ * a = IntSet.new
+ *
+ * # sort order defined by Ruby proc
+ * b = IntSet.new( proc { |a,b| a > b } )
+ *
+ */
+
+%include <rubystdfunctors.swg>
+
+%fragment("StdFunctors");