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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:37:23+00:00 2026-05-30T11:37:23+00:00

I am having a weird error when calling the insert function on a vector

  • 0

I am having a weird error when calling the insert function on a vector of custom types (which are basically graph nodes). Following is the code that is generating the seg fault:

69     for (int i = 0; i < size; i++) {
70         PDTNode * node = arguments[i]->getNode();
71         //addChild(node);
72         children.insert(it, node); // children is vector <PDTNode*> 
73         it++;
74         node->addParent(this);
75     }

I double check all inputs and everything is OK and is not NULL. Below is the gdb stack trace that I got for the seg fault:

#0  0x00007ffff4793202 in ?? () from /lib/libc.so.6
#1  0x00007ffff479163a in memmove () from /lib/libc.so.6
#2  0x00000000004289f1 in std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<PDTNode*> (__first=0x100bd60, __last=0x10053c8, 
__result=0x1001840) at /usr/include/c++/4.4/bits/stl_algobase.h:378
#3  0x00000000004289ab in std::__copy_move_a<false, PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
    at /usr/include/c++/4.4/bits/stl_algobase.h:397
#4  0x0000000000428973 in std::__copy_move_a2<false, PDTNode**, PDTNode**>     (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
    at /usr/include/c++/4.4/bits/stl_algobase.h:436
#5  0x000000000042891d in std::copy<PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
at /usr/include/c++/4.4/bits/stl_algobase.h:468
#6  0x00000000004288dc in std::__uninitialized_copy<true>::uninitialized_copy<PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
    at /usr/include/c++/4.4/bits/stl_uninitialized.h:93
#7  0x0000000000428847 in std::uninitialized_copy<PDTNode**, PDTNode**> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
    at /usr/include/c++/4.4/bits/stl_uninitialized.h:117
#8  0x00000000004287b8 in std::__uninitialized_copy_a<PDTNode**, PDTNode**, PDTNode*> (__first=0x100bd60, __last=0x10053c8, __result=0x1001840)
    at /usr/include/c++/4.4/bits/stl_uninitialized.h:257
#9  0x0000000000428684 in std::__uninitialized_move_a<PDTNode**, PDTNode**, std::allocator<PDTNode*> > (__first=0x100bd60, __last=0x10053c8, 
    __result=0x1001840, __alloc=...) at /usr/include/c++/4.4/bits/stl_uninitialized.h:267
#10 0x000000000042812e in std::vector<PDTNode*, std::allocator<PDTNode*> >::_M_insert_aux (this=0x1002810, __position=..., __x=@0x7fffffffd538)
    at /usr/include/c++/4.4/bits/vector.tcc:338
#11 0x000000000043c46d in std::vector<PDTNode*, std::allocator<PDTNode*> >::insert (this=0x1002810, __position=..., __x=@0x7fffffffd538)
    at /usr/include/c++/4.4/bits/vector.tcc:126
#12 0x00000000004d3ea9 in PDTFunctionDec::setArguments (this=0x10027e0, arguments=...) at PDTFunction.cpp:72

Any help is highly appreciated.

Thank you

  • 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-30T11:37:26+00:00Added an answer on May 30, 2026 at 11:37 am

    I guess it is an iterator, but by inserting an element you trigger a relocation of the elements in the container and therefore invalidate the iterator. That should be the cause of your segmentation fault.

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

Sidebar

Related Questions

I'm having a weird problem with the following function, which returns a string with
I'm having a weird error with some Google App Engine code I'm writing. My
I'm having a weird error. During user creation, if a username already exists in
I'm having some weird issues with pytz's .localize() function. Sometimes it wouldn't make adjustments
I'm having a weird issue with a function I'm trying to call from within
I'm having a weird error with Internet Explorer (Currently version 8, but had the
Using Visual Studio 10 C++, I'm having weird link error. For some reason references
i m having a really weird error: i am using buffered reader (br) and
I'm having a weird error (missing ';', string class not recognized, etc) on an
I'm having a weird error in Rails, I'm making an app where users can

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.