Home | History | Annotate | Download | only in ruby
      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");
     30