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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:37:14+00:00 2026-05-14T02:37:14+00:00

I have the following template declaration: template <typename T> void IterTable(int& rIdx, std::vector<double>& rVarVector,

  • 0

I have the following template declaration:

template <typename T>
   void IterTable(int&                       rIdx,
                  std::vector<double>&       rVarVector,
                  const std::vector<T>&      aTable,
                  const T                    aValue,
                  T              aLowerBound = -(std::numeric_limits<T>::max()), //illegal token on right side of '::' shows here
                  bool                       aLeftOpen = true) const;

Which throws the illegal token error as noted, on the line with “-(std::numeric_limits::max())”. I got this code from some old linux source that I’m trying to compile on Windows. Any idea what the issue is?

Edit: It also fails using min(), and the compiler output is:

Error   92  error C2589: '::' : illegal token on right side of '::' c:\projects\r&d\prepaydll\include\cfcdefault.h  216 PrepayDLL

Error   93  error C2059: syntax error : '::'    c:\projects\r&d\prepaydll\include\cfcdefault.h  216 PrepayDLL

Line 216, is the line previously mentioned.

  • 1 1 Answer
  • 1 View
  • 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-14T02:37:14+00:00Added an answer on May 14, 2026 at 2:37 am

    My guess is that max has been made a macro. This happens at some point inside windows.h.

    Define NOMINMAX prior to including to stop windows.h from doing that.

    EDIT:

    I’m still confident this is your problem. (Not including <limits> would result in a different error). Place #undef max and #undef min just before the function and try again. If that fixes it, I was correct, and your NOMINMAX isn’t being defined properly. (Add it as a project setting.)

    You can also prevent macro expansion by: (std::numeric_limits<T>::max)().


    On a side note, why not do std::numeric_limits<T>::min() instead of negating the 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: template <typename Provider> inline void use() { typedef Provider::Data<int>
I have the following code: template <typename T> LuaCall& operator>>(T) { BOOST_STATIC_ASSERT(sizeof(T) == 0);
I have the following problem: template <int N, typename T> /*what is the return
I have the following pattern: template <int a, int b> class MyClass { public:
I have the following code: template <class T> struct pointer { operator pointer<const T>()
I have written the following code: #include <iostream> using namespace std; template <class T>
I have the following code: #include <stdio.h> template<int A> class Thing { // 5
I'm trying to create a function: template <typename T> void doIt( T*& p )
Given the following code: void f() { class A { template <typename T> void
C++0x shows an example of using std::forward : template<class T> void foo(T&& arg) {

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.