#pragma once //----------------------------------------------------------------------------- // fcn_obj //----------------------------------------------------------------------------- template class fcn_obj { public: fcn_obj (stype & (*f) (stype &, vtype), vtype v): func (f), val (v) { } stype & operator () (stype & s) const { return (*func) (s, val); } private: stype & (*func) (stype &, vtype); vtype val; }; template stype & operator << (stype & ofile, const fcn_obj (im)) { return im (ofile); } template stype & operator >> (stype & ifile, const fcn_obj (im)) { return im (ifile); } //----------------------------------------------------------------------------- // fcn_2obj //----------------------------------------------------------------------------- template class fcn_2obj { public: fcn_2obj (stype & (*f) (stype &, vtype1, vtype2), vtype1 v1, vtype2 v2): func (f), val1 (v1), val2 (v2) { } stype & operator () (stype & s) const { return (*func) (s, val1, val2); } private: stype & (*func) (stype &, vtype1, vtype2); vtype1 val1; vtype2 val2; }; template stype & operator << (stype & ofile, const fcn_2obj (im)) { return im (ofile); } template stype & operator >> (stype & ifile, const fcn_2obj (im)) { return im (ifile); } //----------------------------------------------------------------------------- // fcn_3obj //----------------------------------------------------------------------------- template class fcn_3obj { public: fcn_3obj (stype & (*f) (stype &, vtype1, vtype2, vtype3), vtype1 v1, vtype2 v2, vtype3 v3): func (f), val1 (v1), val2 (v2), val3 (v3) { } stype & operator () (stype & s) const { return (*func) (s, val1, val2, val3); } private: stype & (*func) (stype &, vtype1, vtype2, vtype3); vtype1 val1; vtype2 val2; vtype3 val3; }; template stype & operator << (stype & ofile, const fcn_3obj (im)) { return im (ofile); } template stype & operator >> (stype & ifile, const fcn_3obj (im)) { return im (ifile); } //----------------------------------------------------------------------------- // fcn_4obj //----------------------------------------------------------------------------- template class fcn_4obj { public: fcn_4obj (stype & (*f) (stype &, vtype1, vtype2, vtype3, vtype4), vtype1 v1, vtype2 v2, vtype3 v3, vtype4 v4) : func (f), val1 (v1), val2 (v2), val3 (v3), val4 (v4) { } stype & operator () (stype & s) const { return (*func) (s, val1, val2, val3, val4); } private: stype & (*func) (stype &, vtype1, vtype2, vtype3, vtype4); vtype1 val1; vtype2 val2; vtype3 val3; vtype4 val4; }; template stype & operator << (stype & ofile, const fcn_4obj (im)) { return im (ofile); } template stype & operator >> (stype & ifile, const fcn_4obj (im)) { return im (ifile); }