Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6528251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:31:02+00:00 2026-05-25T09:31:02+00:00

I have to following functions: public enum class SetMinMaxMode { Auto, // min and

  • 0

I have to following functions:

public enum class SetMinMaxMode
{
    Auto, // min and max is set based on the channel data
    Manual
};

generic<typename T> where T : System::ValueType
void SetData(array<T>^ data)
{
    SetData(data, SetMinMaxMode::Auto, Double::MinValue, Double::MaxValue);
}

generic<typename T> where T : System::ValueType
void SetData(array<T>^ data, SetMinMaxMode minMaxMode, Double minValue, Double maxValue)
{
    //
}   

The parameter minValue and maxValue is only used when parameter minMaxMode is SetMinMaxMode::Manual.

If someone writes function like this:

SetData(data, SetMinMaxMode::Auto, desiredMinValue, desiredMaxValue);  

Then he might not know that the last two parameters are not going to be used.

My questions is, is there any way to refactor so that someone will never need to supply unnecessary parameters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:31:03+00:00Added an answer on May 25, 2026 at 9:31 am

    You could write a function that doesn’t take SetMinMaxMode at all.

    SetDataAuto(data);
    

    so you either call the one with min/max or you call the one with auto.

    Your other function would be:

    SetDataManual(data, min, max);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in C++: class Person { public: enum Gender {Male,
I have the following two functions: public class MyClass { public void Save<TObject>(TObject object)
I have a problem with the following code: class SymmetryTypes { public: enum Type
In my CouponsController.php, I have the following 2 functions: public function index() { $this->set('coupons',
If I have the following registry class: Class registry { private $_vars; public function
I have a class with the following member functions: /// caller pid virtual pid_t
say I have the following declarations: public enum Complexity { Low = 0, Normal
I have the following 2 functions: public static string Serialize(object obj) { DataContractSerializer serializer
I have following classes. class A { public: void fun(); } class B: public
I have the following functions: public static V AddIfNotPresent<K, V>( this Dictionary<K, V> store,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.