Message from C, C++ discussions

December 2019

— In the case I mentioned the global var would have to be a * as well


So how is it done?
Long time 😐

I don't want my member function to do multiple things for multiple t-parameters, just want to enable/disable it

— Can you help me in this

Enter 5 Number:
From that 5 number print largest number
And get the sum total of that 5 number

C program

Message permanent page

— ?

— #howtoask

— Try phrasing your question like this:

1. Tell us the problem

2. Tell us what you have done so far.

3. Tell us how you got to this point

4. Paste code in pastebin or something similar

5. Wait for beautiful answers

Message permanent page

— That doesnt follow steps above but ok

— Not OK.
How someone can help you if you don't specify what is the problem?
Does this code compile?
If not with what error do you get?
Does it work correctly?
If not, what is the result? And what is expected result?
If it does compile, and does work correctly, then what's the problem?

Message permanent page

— This

— Why someone who wants to help you should read your mind or guess what you need

— If you want to separate logic for different type parameters, you need to overload or use SFINAE if you want sane function to set of types
if constexpr allows you to make logic of templated function in one place without making several SFINAE overloads

Message permanent page

— Or you can separate logic to some "impl" template functions (without SFINAE logic) and select which function to call in main function with help of if constexpr

Message permanent page