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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:49:16+00:00 2026-06-11T13:49:16+00:00

i have a void pointer void *vp; I want to point it to vec_A

  • 0

i have a void pointer

void *vp;

I want to point it to vec_A inside a function where vec_A is passed as a reference, that is

some_function(std::vector<boost::shared_ptr<A> >& vec_A)
{
   void *vp;
   //now i want vp to point to vec_A
}

and after I point vp to vec_A, how to I get it back as

 std::vector<boost::shared_ptr<A> > 
  • 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-11T13:49:17+00:00Added an answer on June 11, 2026 at 1:49 pm

    Address-of and cast:

    void * vp = &vec_A;   // address-of
    
    std::vector< boost::shared_ptr<A> > & v =
         *static_cast< std::vector< boost::shared_ptr<A> >* >(vp);
    

    Now v is a reference to the very same vector whose address you took in the line above.

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

Sidebar

Related Questions

I have a void pointer returned by dlsym(), I want to call the function
I have: void add_all_msgs(std::deque<Message>::iterator &iter); How can I make that function generic, so it
I have a function that takes a pointer to a floating point array. Based
I have a function that returns a pointer: static void *find_fit(size_t asize); I would
I have a function void foo() and inside foo I call the function void
I want to have a pointer to an UIImage view so that I don't
I have this function: void func(int a, int b, char s, FILE *fp, int
I have this function: void ToUpper(char * S) { while (*S!=0) { *S=(*S >=
Suppose I have a function void myFun(int*) In C++ what exactly does the following
I want to have a static global std::unordered_map in the cpp of my entry

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.