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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:37:26+00:00 2026-06-09T10:37:26+00:00

I have a std::vector<double> In which GDB shows it containing these values: Wph <5

  • 0

I have a std::vector<double> In which GDB shows it containing these values:

Wph <5 items>            vector<double>
    [0] 10.750281685547618      double
    [1] 0.0053087812248281997   double
    [2] 4.2807534148705719e-08  double
    [3] 5.7427427663508097e-07  double
    [4] 0                       double

Upon automatic destruction when the function is exiting, it throws a SIGABRT.

0   raise   raise.c 64  0x7fffeec5ad05  
1   abort   abort.c 92  0x7fffeec5eab6  
2   __libc_message  libc_fatal.c    189 0x7fffeec93d7b  
3   malloc_printerr malloc.c    6283    0x7fffeec9fa8f  
4   _int_free   malloc.c    4795    0x7fffeec9fa8f  
5   __libc_free malloc.c    3738    0x7fffeeca38e3  
6   __gnu_cxx::new_allocator<double>::deallocate    new_allocator.h 95  0x457828    
7   std::_Vector_base<double, std::allocator<double> >::_M_deallocate   stl_vector.h    146 0x45567e    
8   std::_Vector_base<double, std::allocator<double> >::~_Vector_base   stl_vector.h    132 0x4542b3    
9   std::vector<double, std::allocator<double> >::~vector   stl_vector.h    314 0x453a96

What’s going on?

  int data = 0;
  vector<double> Wph;
  Wph.resize(mydata.data.size());

  for (size_t t = 0; t < mydata.t.size(); t++)
  {
    double t0 = (PI / 180.0) * mydata.t[i];

    for (size_t p = 0; p < mydata.p.size(); p++)
    {

      double _Wph = 5; //arbitrary math
      Wph[data] = _Wph;

      data++;
    }
  }

struct mydata
{
  vector<double> t, p;
  vector<point> data;
};
  • 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-09T10:37:27+00:00Added an answer on June 9, 2026 at 10:37 am

    Please make sure mydata.data.size() == mydata.t.size() * mydata.p.size().

    You assigned mydata.t.size() * mydata.p.size() values into a vector with mydata.data.size() elements. That’s an array bound write.

    Maybe you should try vector::push_back() instead. That is,

    vector<double> Wph;
    
    for (size_t t = 0; t < mydata.t.size(); t++)
    {
      double t0 = (PI / 180.0) * mydata.t[i];
    
      for (size_t p = 0; p < mydata.p.size(); p++)
      {
        double _Wph = 5; //arbitrary math
        Wph.push_back(_Wph);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a std::vector which holds std::vector of double. I'd want to sort
I have a vector containing integer values, which I wish to sum. However, it's
I have the following template declaration: template <typename T> void IterTable(int& rIdx, std::vector<double>& rVarVector,
I have an std::vector of handle objects. I have to wait on these handle
I have: struct DoubleVec { std::vector<double> data; }; DoubleVec operator+(const DoubleVec& lhs, const DoubleVec&
Hello I have a function which signature is std::string f(double x, double param1, double
I have a typedef boost::variant<int, float, double, long, bool, std::string, boost::posix_time::ptime> variant which I
I have the following C++ code std::map<std::string, std::vector<std::vector<std::vector<double> > > > details details[string][index][index].push_back(123.5); May
I have a std::vector of some class of the form class A{ public: A():i(someNumber){}
I have an std::vector that holds all the objects and is passed to them

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.