Boost logo

Boost :

From: vamshi mugu (boost_vam_at_[hidden])
Date: 2002-10-31 20:04:16


This is the GeneratorConcept from
http://www.boost.org/boost/concept_check.hpp

template <class Func, class Return>
  struct GeneratorConcept
  {
    void constraints() {
      const Return& r = f(); // require operator()
      ignore_unused_variable_warning(r);
    }
    Func f;
  };

---- and this is the UnaryFunctionConcept

template <class Func, class Return, class Arg>
  struct UnaryFunctionConcept
  {
    // required in case any of our template args are
const-qualified:
    UnaryFunctionConcept();

    void constraints() {
      r = f(arg); // require operator()
    }
    Func f;
    Arg arg;
    Return r;
  };

----------------------------
As it is, the UnaryFunctionConcept requires that
'Return' be non-const (while there is no such
requirement on the 'Return' in GeneratorConcept)

Is there a good reason why these two are different ?
That is, would
const Return& r = f();
not work for UnaryFunctionConcept too?

=====
Vamshi Mugu
North Dakota State University

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/


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