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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:28:21+00:00 2026-05-15T19:28:21+00:00

When using the std::map with types that use trivial, non-throwing, copy constructors, a compiler

  • 0

When using the std::map with types that use trivial, non-throwing, copy constructors, a compiler warning/error is thrown (warning level 4, release mode) for unreachable code in xtree. This is because the std::map has a try-catch in it that helps maintain the state of the tree in the case of an exception, but the compiler figures out that the catch statement will never be called if the stored elements don’t throw. These warnings can be easily suppressed with the following lines at the top of the .cpp file:

#pragma warning(push)
#pragma warning(disable:4702)
#include <xtree>
#pragma warning(pop)

Is there a way to bypass this warning/error without changing the warning level, building in debug, suppressing the warning, or using a different type in the map? Is there plans to change this in the standard library?

Update:
Maybe it is compiler specific. I am using vc7.
The error is below:

c:\program files\microsoft visual studio .net 2003\vc7\include\xtree(1116) : error C2220: warning treated as error – no ‘object’ file generated
c:\program files\microsoft visual studio .net 2003\vc7\include\xtree(1116) : warning C4702: unreachable code

Apparently the xtree is used by the std::map.

  • 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-15T19:28:22+00:00Added an answer on May 15, 2026 at 7:28 pm

    Unfortunately it looks like xtree is part of the underlying implementation of map in VC7, and as such there isn’t much that can be done to mitigate it. It looks like it’s a bug in the standard library.

    Is it a possibility to use a newer compiler? I’m fairly sure there are free downloads of more recent versions of the compiler you could use, and perhaps they’ve fixed this issue.

    If that’s not an option, probably the best solution is to wrap the include of map into your own private header, complete with a comment and the #pragma+include <xtree> lines you already discovered (in addition to an include of map. This way you hide the workaround from normal use.

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

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here were the assorted issues: 1) I had to manually… May 16, 2026 at 3:41 pm
  • Editorial Team
    Editorial Team added an answer I found the problem. My ItemContainerStyle Template had a rectangle… May 16, 2026 at 3:41 pm
  • Editorial Team
    Editorial Team added an answer How about wrapping the TextBox within a couple of panels?… May 16, 2026 at 3:41 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

So, I'm using a std::map as an associative array. The map is declared as
I'm using a std::map (VC++ implementation) and it's a little slow for lookups via
A recent talk about unordered_map in C++ made me realize that I should use
I'm using a map as a thread specific cache to keep track of failed
I have a symbol table implemented as a std::map . For the value, there
I have a std::map, and I would like to add a valid key to
I am trying to create a map using two arrays. Here is the code:
I am leaning towards using std::tr1::shared_ptr to automatically manage a pointer to a utility
How do I make a tree data structure in C++ that uses iterators instead
I have a join function that operates on STL strings. I want to be

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.