PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/ruby/std_functors.i

#
Swig | 29 lines | 2 code | 2 blank | 25 comment | 0 complexity | abbc6bf51d5241972a8245c71de62d5c MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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. %include <rubystdfunctors.swg>
  27. %fragment("StdFunctors");