Click here to Skip to main content
16,016,738 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionStructure members in a listbox Pin
Chandrasekharan P14-Jul-09 1:07
Chandrasekharan P14-Jul-09 1:07 
QuestionRe: Structure members in a listbox [modified] Pin
Adam Roderick J14-Jul-09 1:22
Adam Roderick J14-Jul-09 1:22 
AnswerRe: Structure members in a listbox Pin
Rajesh R Subramanian14-Jul-09 1:23
professionalRajesh R Subramanian14-Jul-09 1:23 
AnswerRe: Structure members in a listbox Pin
Chandrasekharan P14-Jul-09 1:29
Chandrasekharan P14-Jul-09 1:29 
AnswerRe: Structure members in a listbox Pin
Muhammad Mazhar14-Jul-09 1:40
Muhammad Mazhar14-Jul-09 1:40 
Questioncreate a reference vector of class objects Pin
002comp14-Jul-09 0:58
002comp14-Jul-09 0:58 
AnswerRe: create a reference vector of class objects Pin
CPallini14-Jul-09 2:18
mveCPallini14-Jul-09 2:18 
AnswerRe: create a reference vector of class objects Pin
Graham Shanks14-Jul-09 2:22
Graham Shanks14-Jul-09 2:22 
You need to clarify your question a bit.

First, please use the code block tags around your example code. Standard HTML does not render code properly

Secondly, you need to show the implementation (or a cut down version of it) of the get_m1 method

Thirdly, what is the problem that you are getting during m1.push_back?

I'm not sure what you mean by a "reference vector of class objects".

Do you mean a vector of references to class objects? If you do then this will not compile since it is not possible to have a vector (or any other container) of references. The type for std::vector must be assignable[^], and references are not assignable. Use a vector of pointers to objects instead.

Or do you mean a reference to a vector of class objects? This is at least legal and should work, e.g.

class Piece
{
};

class Garment
{
public:
  std::vector<Piece>& get_m1()
  {
    return pieces;
  }

private:
  std::vector<Piece> pieces;
};

static void foo()
{
  Garment garment;
  std::vector<Piece>& m1 = garment.get_m1();
  Piece piece1;
  m1.push_back(piece1);
}


Graham

Librarians rule, Ook!

QuestionShellExecute does not work with utf-8 encoded files Pin
venera_soft14-Jul-09 0:26
venera_soft14-Jul-09 0:26 
AnswerRe: ShellExecute does not work with utf-8 encoded files Pin
Michael Schubert14-Jul-09 0:55
Michael Schubert14-Jul-09 0:55 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft14-Jul-09 1:05
venera_soft14-Jul-09 1:05 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
Michael Schubert14-Jul-09 1:18
Michael Schubert14-Jul-09 1:18 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft14-Jul-09 1:20
venera_soft14-Jul-09 1:20 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
Michael Schubert14-Jul-09 1:33
Michael Schubert14-Jul-09 1:33 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft14-Jul-09 1:37
venera_soft14-Jul-09 1:37 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
Michael Schubert14-Jul-09 1:56
Michael Schubert14-Jul-09 1:56 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft14-Jul-09 2:23
venera_soft14-Jul-09 2:23 
AnswerRe: ShellExecute does not work with utf-8 encoded files Pin
Joe Woodbury14-Jul-09 6:42
professionalJoe Woodbury14-Jul-09 6:42 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft14-Jul-09 11:05
venera_soft14-Jul-09 11:05 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
Joe Woodbury14-Jul-09 11:05
professionalJoe Woodbury14-Jul-09 11:05 
QuestionRe: ShellExecute does not work with utf-8 encoded files Pin
David Crow14-Jul-09 8:54
David Crow14-Jul-09 8:54 
AnswerRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft15-Jul-09 22:42
venera_soft15-Jul-09 22:42 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
David Crow16-Jul-09 2:30
David Crow16-Jul-09 2:30 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
venera_soft16-Jul-09 23:12
venera_soft16-Jul-09 23:12 
GeneralRe: ShellExecute does not work with utf-8 encoded files Pin
David Crow17-Jul-09 2:08
David Crow17-Jul-09 2:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.