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 7158755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:07:08+00:00 2026-05-28T13:07:08+00:00

Could I use an std functions in a template functions? I have add and

  • 0

Could I use an std functions in a template functions?
I have add and wrote

#pragma region BlendFunctions

template <class T> 
T BlendLightenf(T x, T y) 
{ 
    return std::max(x, y); //errors here
} 
template <class T> 
T BlendDarkenf(T x, T y) 
{ 
  return std::min(x, y); //errors here
} 

And get

error C2589: '(' : illegal token on right side of '::'

and

error C2059: syntax error : '::'

right in the one string (x and y are usually float).

My defines:

#ifdef MAGICLIB_EXPORTS
#define CPPWIN32DLL_API __declspec(dllexport)
#else
#define CPPWIN32DLL_API __declspec(dllimport)
#endif


#include <stdio.h>
#include <string>
#include <algorithm> 
  • 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-28T13:07:08+00:00Added an answer on May 28, 2026 at 1:07 pm

    Check that max isn’t defined by somebody else.

    Sometimes you include a file that defines max as something else (most likely (a > b ? a : b) or something like that).

    If you have one of those files included the preprocessor will break std::max by replacing max with its definition (something like this std::(a > b ? a : b)) and you get a strange error.

    You can add #undef max after the offending header and you’ll be ok.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I could use some help creating an XSL template that will take a string
We're having a small issue and could use some help - we have the
I have the following class template: template<class T, unsigned N> class MyClass; where T
Given: template<typename T> class A { B b; std::vector<T> vec1; std::vector<T> vec2; } I'd
I know that compilers have much freedom in implementing std::type_info functions' behavior. I'm thinking
I have written a runtime-created dialog class that doesn't use any resource files based
Given a functor appropriate for use with std::for_each and friends: template <typename T> struct
I have a debug class that I use in my code to print various
I could use some help writing a regular expression. In my Django application, users
I could use the following: <fileset dir=C:\Program Files\eclipse\plugins\myplugin> <include name=extraStuff.jar /> </fileset> But that

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.