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

  • SEARCH
  • Home
  • 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 8631701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:15:14+00:00 2026-06-12T09:15:14+00:00

I’m using a data structure that wants to use STL limits to determine the

  • 0

I’m using a data structure that wants to use STL limits to determine the min, max, and infinity (I think only these) values of a struct I’m giving it. I’m using Visual C++ 2010, if there is implementation specific details for this stuff.

Here’s the basic structure of my data types, with PseudoTuple::ReturnWrapper being the type needing limits support:

struct PseudoTuple
{
 struct ReturnWrapper
 {
  //wraps return values for comparisons and such
 }

 typedef ReturnWrapper value_type;

 //basic "tuple" implementation as a data front
}

With the power of copy and paste, I created a small numeric_limits class for it, implementing only the 3 functions I think are required. The return values are currently temporary, just to see if this will compile.

namespace std
{
 template<> class _CRTIMP2_PURE numeric_limits<PseudoTuple::ReturnWrapper>
  : public _Num_int_base
 {
 public:
  typedef PseudoTuple::ReturnWrapper _Ty;

  static _Ty (__CRTDECL min)() _THROW0()
  { // return minimum value
   return PseudoTuple::ReturnWrapper();
  }

  static _Ty (__CRTDECL max)() _THROW0()
  { // return maximum value
   return PseudoTuple::ReturnWrapper();
  }

  static _Ty __CRTDECL infinity() _THROW0()
  { // return positive infinity
   return PseudoTuple::ReturnWrapper();
  }
 };
}

#include <data structure using PseudoTuple>

And I include the header after this to make sure it can grab these declarations. I’m getting an error in it here:

namespace detail {

 template<typename coordinate_type, bool is_integer, bool has_infinity>
 struct coordinate_limits_impl;

 template<typename coordinate_type>
 struct coordinate_limits_impl<coordinate_type, true, false> {
  static const coordinate_type highest() {
   return std::numeric_limits<coordinate_type>::max(); // --- error here ---
  }
  static const coordinate_type lowest() {
   return std::numeric_limits<coordinate_type>::min();
  }
 };

//lots of stuff

}

coordinate_type is a typedef of PseudoTuple::ReturnWrapper. Here’s the error:

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

And also getting this interesting warning on all uses of min and max, this one being on the same line as the error:

warning C4003: not enough actual parameters for macro 'max'

When I use this data structure with an std::array of std::string, I still get those warnings but no compiler errors pop up. It also runs properly in that case, so the whole thing must work somehow. But it doesn’t recognize the max function when using my custom numeric_limits.

If I change the max() to infinity(), it compiles fine and moves on to throwing an error on min(). The names min and max are giving it some grief, but I’m not sure why. This does tell me that it can grab the infinity method from my implementation of numeric_limits, though.

edit: Removed data structure code showing the right type is being passed in, seems irrelevant.

edit 2: Mark B solved the problem, but a new one popped up:

error LNK2019: unresolved external symbol "__declspec(dllimport) public: static struct PseudoTuple::ReturnWrapper __cdecl std::numeric_limits<struct PseudoTuple::ReturnWrapper>::max(void)" (__imp_?max@?$numeric_limits@UReturnWrapper@PseudoTuple@@@std@@SA?AUReturnWrapper@PseudoTuple@@XZ) referenced in function "public: static struct PseudoTuple::ReturnWrapper const __cdecl kd_v1_0_8::spatial::detail::coordinate_limits_impl<struct PseudoTuple::ReturnWrapper,1,0>::highest(void)" (?highest@?$coordinate_limits_impl@UReturnWrapper@PseudoTuple@@$00$0A@@detail@spatial@kd_v1_0_8@@SA?BUReturnWrapper@PseudoTuple@@XZ)

So something is messing up the linking… Getting the same for min but not for infinity.

  • 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-06-12T09:15:15+00:00Added an answer on June 12, 2026 at 9:15 am

    Sometimes min and max were implemented as macros which just substitute text. It’s not your specialization that’s causing issues here but the macros. I believe windows.h is one such offender. You can use #define NOMINMAX to cause them to not be created as macros.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.