Click here to Skip to main content
16,020,706 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why won't VS2015 let me compile? Pin
charlieg25-Apr-22 0:56
charlieg25-Apr-22 0:56 
JokeRe: Why won't VS2015 let me compile? Pin
Randor 21-Apr-22 14:04
professional Randor 21-Apr-22 14:04 
GeneralRe: Why won't VS2015 let me compile? Pin
charlieg22-Apr-22 0:19
charlieg22-Apr-22 0:19 
AnswerRe: Why won't VS2015 let me compile? Pin
charlieg22-Apr-22 0:29
charlieg22-Apr-22 0:29 
AnswerRe: Why won't VS2015 let me compile? Pin
Richard Andrew x6423-Apr-22 3:47
professionalRichard Andrew x6423-Apr-22 3:47 
GeneralRe: Why won't VS2015 let me compile? Pin
charlieg25-Apr-22 2:31
charlieg25-Apr-22 2:31 
QuestionMoving a STL container around Pin
Calin Negru15-Apr-22 22:16
Calin Negru15-Apr-22 22:16 
AnswerRe: Moving a STL container around Pin
Richard MacCutchan15-Apr-22 23:15
mveRichard MacCutchan15-Apr-22 23:15 
Yes, STL containers are just template classes and can be manipulated the same as any class objects. And as such, a vector may contain objects, or pointers to objects. But remember in the second case that the items pointed to, must not be removed while the vector still owns them.
C++
std::vector<char*>* pMyvec = new std::vector<char*>(); // a pointer to a vector of pointers.
// use push_back to fill the vector with pointers:
pMyvec->push_back("A string");
pMyvec->push_back("Another string");

// pass the vectro to a function:
int result = myfun(pMyvec);
// on return the contents may have been changed


BTW you should not use malloc in C++ code, as new and delete is the correct way to manage memory.
GeneralRe: Moving a STL container around Pin
Calin Negru16-Apr-22 0:18
Calin Negru16-Apr-22 0:18 
GeneralRe: Moving a STL container around Pin
Greg Utas16-Apr-22 1:00
professionalGreg Utas16-Apr-22 1:00 
GeneralRe: Moving a STL container around Pin
Calin Negru16-Apr-22 3:01
Calin Negru16-Apr-22 3:01 
GeneralRe: Moving a STL container around Pin
Richard MacCutchan16-Apr-22 5:59
mveRichard MacCutchan16-Apr-22 5:59 
GeneralRe: Moving a STL container around Pin
Calin Negru16-Apr-22 9:34
Calin Negru16-Apr-22 9:34 
QuestionMessage Closed Pin
5-Apr-22 16:02
Member 149687715-Apr-22 16:02 
AnswerRe: macro usage error Pin
Victor Nijegorodov5-Apr-22 20:35
Victor Nijegorodov5-Apr-22 20:35 
AnswerRe: macro usage error Pin
Richard MacCutchan5-Apr-22 21:24
mveRichard MacCutchan5-Apr-22 21:24 
Questionmain.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
Nagavarapu Pavan4-Apr-22 20:23
Nagavarapu Pavan4-Apr-22 20:23 
AnswerRe: main.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
CPallini4-Apr-22 21:47
mveCPallini4-Apr-22 21:47 
GeneralRe: main.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
Nagavarapu Pavan4-Apr-22 21:56
Nagavarapu Pavan4-Apr-22 21:56 
GeneralRe: main.c:37:37: error: expected expression at end of input 37 | if (bind(server_fd, (struct sockaddr *)&address, | ^~~~~~~~ Pin
CPallini4-Apr-22 22:46
mveCPallini4-Apr-22 22:46 
QuestionCan not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar1-Apr-22 10:17
Alex Banar1-Apr-22 10:17 
AnswerRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Victor Nijegorodov1-Apr-22 20:42
Victor Nijegorodov1-Apr-22 20:42 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar2-Apr-22 2:01
Alex Banar2-Apr-22 2:01 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Victor Nijegorodov2-Apr-22 2:55
Victor Nijegorodov2-Apr-22 2:55 
GeneralRe: Can not create object of DirectorySearcher class with Visual C++ with project reference of System.DirectoryServices.dll Pin
Alex Banar2-Apr-22 10:08
Alex Banar2-Apr-22 10: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.