PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Lib/ruby/std_functors.i

#
Swig | 29 lines | 2 code | 2 blank | 25 comment | 0 complexity | abbc6bf51d5241972a8245c71de62d5c MD5 | raw file
 1/**
 2 * @file   std_functors.i
 3 * @date   Sun May  6 00:44:33 2007
 4 * 
 5 * @brief  This file provides unary and binary functors for STL
 6 *         containers, that will invoke a Ruby proc or method to do
 7 *         their operation.
 8 *
 9 *         You can use them in a swig file like:
10 *
11 *         %include <std_set.i>
12 *         %include <std_functors.i>
13 *
14 *         %template< IntSet > std::set< int, swig::BinaryPredicate<int> >;
15 *
16 *
17 *         which will then allow calling them from Ruby either like:
18 *  
19 *            # order of set is defined by C++ default
20 *            a = IntSet.new
21 *
22 *            # sort order defined by Ruby proc
23 *            b = IntSet.new( proc { |a,b| a > b } )
24 * 
25 */
26
27%include <rubystdfunctors.swg>
28
29%fragment("StdFunctors");