Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Would it make any sense to template the function object class below? ( i . e . Would anyone ever need to scale anything besides

Would it make any sense to template the function object class below? (i.e. Would anyone ever need to scale anything besides doubles or their immediate built-in subsets?)
class Scale
{
double scale_factor;
public:
Scale( double actual, double desired =100.0)
: scale_factor{desired / actual}{}
double operator ()( double a ) const
{ return a * scale_factor ; }
void set_scaling( double actual, double desired )
{ scale_factor = desired / actual ; return ; }
void set_scaling( double multiple )
{ scale_factor = multiple ; return ; }
};

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Predict the product(s) of this elimination reaction. Cl base

Answered: 1 week ago

Question

using signal flow graph

Answered: 1 week ago