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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:27:59+00:00 2026-05-28T02:27:59+00:00

I have the following deceleration in my header file // 3D Vector typedef struct

  • 0

I have the following deceleration in my header file

// 3D Vector
typedef struct tagV3D /*: V2D*/ {
  union {
   struct {
          double x;
          double y;
          double z;
   };
   struct {
          struct tagV2D v2d_;
   };
 };
} V3D, TVec3D, *PVec3D;

now i have a method inside my cpp file

    bool InsertSelfIntersectionVertexes(vector<PVec3D> &avtxlst) {

    PVec3D vtx;
    int iI;
    ...

    vtx = new TVec3D;
    *vtx = v;
    PVec3D* p= avtxlst.begin() + iI + 1;
    avtxlst.insert(p, vtx);

    ...
    }  

I get following errors trying to compile the code

error C2440: 'initializing' : cannot convert from 'std::_Vector_iterator<_Ty,_Alloc>' to 'PVec3D *'
and
error C2664: 'std::_Vector_iterator<_Ty,_Alloc> std::vector<_Ty>::insert(std::_Vector_const_iterator<_Ty,_Alloc>,const _Ty &)' : cannot convert parameter 1 from 'PVec3D' to 'std::_Vector_const_iterator<_Ty,_Alloc>'

How do I Fix this?

The following code worked fine with vc6 and the errors appeared when migrated to VS 2008.
Why is that ?
Appreciate any answers

  • 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-28T02:28:00+00:00Added an answer on May 28, 2026 at 2:28 am

    A vector<T>::iterator is a type by itself and is not compatible with your pointer to your struct. You should create a vector<PVec3D>::iterator my_iter = avtxlst.begin().

    Now you can do the same operations on your iterator, as you can with the pointer you had. Such as increment, my_iter++ or dereference *my_iter.

    You can then use my_iter and increment it by Ii and whatever else you need to do.

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

Sidebar

Related Questions

I have the following template declaration: template <typename T> void IterTable(int& rIdx, std::vector<double>& rVarVector,
I have setup the following header file to create a Stack which uses an
I have a header file port.h, port.c, and my main.c I get the following
I have the following header file, but keep on getting: syntax error : missing
I have structure declaration in a header globalStruct.h #ifndef _GLOBALSTRUCT_H #define _GLOBALSTRUCT_H typedef struct
I have the following decleration: private Dictionary<string, Dictionary<string, File>> listFiles = new Dictionary<string,Dictionary<string,File>>(); How
I have the following code in a header included in main.mm: 1. virtual int
I have been given a header with the following declaration: //The index of 1
I have a header file with about 400 function declarations and its corresponding source
I have a header file... #include <SFML\Graphics.hpp> #include <SFML\Graphics\Drawable.hpp> #include <SFML\System.hpp> #include <iostream> #ifndef

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.