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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:34:58+00:00 2026-06-13T18:34:58+00:00

I understand How to convert vector to array in C++ answers how to convert

  • 0

I understand “How to convert vector to array in C++“

answers how to convert a vector of doubles (NON POINTER TYPE) to an array.

My requirement :: To convert (a vector of CustomClass pointers) to (a CustomClass pointer to an array of CustomClass pointers).

Does the following code mean “(vector of pointers) –> (Pointer to an array of CustomClass pointers)”

std::vector <CustomClass*> vectorObject(SizeOfVector);  // Here each element of the vector //is a pointer to CustomClass object.
CustomClass* customClassArray = &vectorObject[0];

Please correct me if I am wrong. Kindly Help with a code snippet.

Thanks in advance.

  • 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-13T18:34:59+00:00Added an answer on June 13, 2026 at 6:34 pm

    Vector is a wrapper in a sorts for an array and provides all the features of an array whilst also allowing the array to grow shrink know how big it is and a lot of other useful features. One of the requirements of std vector is that its data is stored in a contiguous fashion like an array. Because of this requirement you can get an array of elements by taking the address of the first element regardless of type.

    std::vector <CustomClass*>vectorObject Means that you have a vector of CustomClass Pointers to get an array

    CustomClass **Array = &vectorObject[0] Now I have taken the contiguous data segment at offset 0 in the vector and assigned it the a pointer pointer of customclass remember that arrays and pointers are deeply connected in c and c++ I can now access the pointer pointer as if it were an array

    CustomClass * FirstEle = Array[0];

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

Sidebar

Related Questions

Please help me understand, the below code is showing Type mismatch: cannot convert from
Am just trying to understand why this exception throws. Cannot implicitly convert type 'System.DateTime?'
I understand that compilers convert c source code to assembly and then to machine
Through searches, I understand the way (or, a way) to convert an Array to
I'm using opencv2 c++ interface. I want to understand how convert color from Scalar
I want to understand how to convert signed number into unsigned. lets say I
I cannot understand the error because I'm not trying to convert to numeric the
I kinda understand how to convert elementary functions such as arithmetics to continuation-passing style
I am trying to understand how to convert infix to prefix in order to
I'm trying to learn to convert EBNF to C# code. Sample: int <ident> =

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.