Boost logo

Boost :

From: nbecker_at_[hidden]
Date: 2001-05-16 11:21:25


I believe this simple class belongs in a standard library since it's
so useful:

#ifndef Constant_H
#define Constant_H

template<typename out_t>
class Constant {
  const out_t val;
public:
  Constant (out_t _val) :
    val (_val) {}

  template<typename T>
  out_t operator() (T x) const {
    return val;
  }
};

#endif


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk