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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:48:08+00:00 2026-05-30T23:48:08+00:00

With a static std::forward_list, the debugger only shows the 1’st element. A non static

  • 0

With a static std::forward_list, the debugger only shows the 1’st element.

A non static std::forward_list or a static std::list works fine.

Is there any work around in the debugger I could use?

#include "stdafx.h"
#include <forward_list>
#include <list>

int _tmain(int argc, _TCHAR* argv[])
{
    static std::forward_list<int> sfl;
    sfl.push_front( 1 ); 
    sfl.push_front( 2 );

    std::forward_list<int> fl;
    fl.push_front( 1 ); 
    fl.push_front( 2 );

    static std::list<int> sl;
    sl.push_front( 1 ); 
    sl.push_front( 2 );

    //Break here.
    //In a debugger watch window:
    //  'sfl' only shows the '2' element
    //  'fl' & 'sl' shows all elements.
    return 0;
}
  • 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-30T23:48:10+00:00Added an answer on May 30, 2026 at 11:48 pm

    I believe this is a bug in Visual Studio’s debugger visualizer. The closest thing to a workaround I’ve come up with is to modify the forward_list entry in autoexp.dat (normally found in %VSINSTALLDIR%\Common7\Packages\Debugger\)

    The file should have a section with the following:

    ;------------------------------------------------------------------------------
    ;  std::forward_list from <forward_list>
    ;------------------------------------------------------------------------------
    std::forward_list<*>{
        preview (
            #(
                "(",
                #list(
                    head: $e._Myhead,
                    next: _Next
                ) : $e._Myval,
                ")"
            )
        )
    
        children (
            #list(
                head: $e._Myhead,
                next: _Next
            ) : $e._Myval
        )
    }
    

    Replace with:

    ;------------------------------------------------------------------------------
    ;  std::forward_list from <forward_list>
    ;------------------------------------------------------------------------------
    std::forward_list<*>{
        preview (
            #(
                "(",
                #(
                    $e._Myhead->_Myval,
                    ",",
                    #list(
                        head: $e._Myhead->_Next,
                        next: _Next
                    ) : $e._Myval,
                ),
                ")"
            )
        )
    
        children (
            #(
                [actual 0]: $e._Myhead->_Myval,
                #list(
                    head: $e._Myhead->_Next,
                    next: _Next
                ) : $e._Myval
            )
        )
    }
    

    This is not a great solution. It displays the children as [actual 0], [0], [1], ... rather than [0], [1], [2], ..., i.e. element x is labelled [x-1].

    You can however modify autoexp.dat without closing Visual Studio, you just need to restart the debugger. So I’d recommend using this hack for just as long as you need to debug a particular issue, and then revert back to the original autoexp.dat.

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

Sidebar

Related Questions

For static member initialization I use a nested helper struct, which works fine for
Possible Duplicate: Does std::list::remove method call destructor of each removed element? I have a
I have a static std::vector in a class. When I use Microsoft's memory leak
If I have a class called Test :: class Test { static std::vector<int> staticVector;
I have some code that looks like: static const std::string and( AND ); This
public static void main(String[] args) { List<? extends Object> mylist = new ArrayList<Object>(); mylist.add(Java);
I have a static std::map<std::string, CreateGUIFunc> in a class that basically holds strings identifying
I have a class with a static std::map member variable that maps char s
I have the following code: void Foo() { static std::vector<int>(3); // Vector object is
Consider the following snippet: #include <map> class A { static std::map<int,int> theMap; #pragma omp

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.