return a map from a function
-
Im using a map to store data.So i want to return the map. map* RSUserControlContainer::GetAnswers() { //UserControlInfo is a structure map mapAnswers = new map; --------------- --------------------------//Other code ----------------------------------- return mapAnswers ; } But It give some errors.So how can i return a map from a function. bhw
-
Im using a map to store data.So i want to return the map. map* RSUserControlContainer::GetAnswers() { //UserControlInfo is a structure map mapAnswers = new map; --------------- --------------------------//Other code ----------------------------------- return mapAnswers ; } But It give some errors.So how can i return a map from a function. bhw
some syntax i typed here is not visible when i post it.map means map C++ map. bhw
-
Im using a map to store data.So i want to return the map. map* RSUserControlContainer::GetAnswers() { //UserControlInfo is a structure map mapAnswers = new map; --------------- --------------------------//Other code ----------------------------------- return mapAnswers ; } But It give some errors.So how can i return a map from a function. bhw
Hi, map mapAnswers, is not the pointer, Do you forgot it.
-
Im using a map to store data.So i want to return the map. map* RSUserControlContainer::GetAnswers() { //UserControlInfo is a structure map mapAnswers = new map; --------------- --------------------------//Other code ----------------------------------- return mapAnswers ; } But It give some errors.So how can i return a map from a function. bhw
TobetheWinner wrote:
But It give some errors.
What errors?
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.
-
some syntax i typed here is not visible when i post it.map means map C++ map. bhw
use <pre>, <, > symbols from formatting option when you compose the post
-
Im using a map to store data.So i want to return the map. map* RSUserControlContainer::GetAnswers() { //UserControlInfo is a structure map mapAnswers = new map; --------------- --------------------------//Other code ----------------------------------- return mapAnswers ; } But It give some errors.So how can i return a map from a function. bhw
But you didnt say any thing about errors.
WhiteSky
-
some syntax i typed here is not visible when i post it.map means map C++ map. bhw
map<int ,UserControlInfo>* RSUserControlContainer::GetAnswers()
{
//UserControlInfo is a structure
map<int, AnswerType> mapAnswers = new map<int, AnswerType>;
return mapAnswers ;
}The compiler is probably complaining about returning an
AnswerType
map when the function's return type specifies aUserControlInfo
map.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne