Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / stl vector Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
devil20

April 04, 2005, 11:41 PM

Hi
I am using stl vector for simple mesh operation. I need const_pointer and also pointer of some variable so i how can i get it ??
For example :

  1.  
  2.  
  3. std::vector<int> Indices;
  4.  
  5. int getIndices() const
  6. {
  7.  // retuns indices const_pointer . this function return const_pointer
  8.  
  9. }
  10.  
  11.  


So like example how can i return const_pointer of indices ???
Any suggestion ???

devil20

 
Steven Don

April 05, 2005, 12:30 AM

Try simply:

  1.  
  2. const int *getIndices () const
  3. {
  4.     return (const int *)(&Indices [0]);
  5. }
  6.  

 
devil20

April 05, 2005, 02:00 AM

Thanx :)

I understand :)

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.