~ubuntu-branches/ubuntu/oneiric/libtorrent/oneiric

« back to all changes in this revision

Viewing changes to rak/functional.h

  • Committer: Bazaar Package Importer
  • Author(s): Jose Luis Rivas
  • Date: 2007-09-11 15:12:31 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20070911151231-brompt7pecvfbaau
Tags: 0.11.8-1
* New upstream version
* debian/patches/update-changelog.patch:
 + Updated with the new changelog.
* debian/control:
 + Added the Homepage field, deleted Homepages from the descriptions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// rak - Rakshasa's toolbox
2
 
// Copyright (C) 2005-2006, Jari Sundell
 
2
// Copyright (C) 2005-2007, Jari Sundell
3
3
//
4
4
// This program is free software; you can redistribute it and/or modify
5
5
// it under the terms of the GNU General Public License as published by
457
457
// be replaced by TR1 stuff later. Requires an object to bind, instead
458
458
// of using a seperate functor for that.
459
459
 
 
460
template <typename Ret>
 
461
class ptr_fun0 {
 
462
public:
 
463
  typedef Ret result_type;
 
464
  typedef Ret (*Function)();
 
465
 
 
466
  ptr_fun0() {}
 
467
  ptr_fun0(Function f) : m_function(f) {}
 
468
 
 
469
  bool is_valid() const { return m_function; }
 
470
 
 
471
  Ret operator () () { return m_function(); }
 
472
  
 
473
private:
 
474
  Function m_function;
 
475
};
 
476
 
460
477
template <typename Object, typename Ret>
461
478
class mem_fun0 {
462
479
public:
569
586
  Function m_function;
570
587
};
571
588
 
 
589
template <typename Ret>
 
590
inline ptr_fun0<Ret>
 
591
ptr_fun(Ret (*f)()) { return ptr_fun0<Ret>(f); }
 
592
 
572
593
template <typename Object, typename Ret>
573
594
inline mem_fun0<Object, Ret>
574
595
make_mem_fun(Object* o, Ret (Object::*f)()) {