How to make a dynamic storage of objects (c++)
up vote
0
down vote
favorite
I am a beginner to programming and I am trying to find a way to create a dynamic storage of objects of my pigeon class. Here is my code:
class pigeon {
public:
pigeon(std::string nameI);
void outputInfo();
private:
std::string name;
};
The idea is that I want to be able to add a new object, have a place to store its information, then be able to add another object, and so on. I have no idea where to start with this or even what data structure to use, I have no experience storing objects.
c++ data-structures
add a comment |
up vote
0
down vote
favorite
I am a beginner to programming and I am trying to find a way to create a dynamic storage of objects of my pigeon class. Here is my code:
class pigeon {
public:
pigeon(std::string nameI);
void outputInfo();
private:
std::string name;
};
The idea is that I want to be able to add a new object, have a place to store its information, then be able to add another object, and so on. I have no idea where to start with this or even what data structure to use, I have no experience storing objects.
c++ data-structures
4
Are the objects you want to store of the same type? If so you can simply use astd::vector<YourObject>
– Zpalmtree
Nov 21 at 22:14
4
std::vector
– François Andrieux
Nov 21 at 22:15
You need to indicate in your question what you mean by store. Do you mean in memory or something more permanent?
– Kit
Nov 21 at 22:17
As @FrançoisAndrieux already said. Use astd::vector
.
– Jesper Juhl
Nov 21 at 22:37
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am a beginner to programming and I am trying to find a way to create a dynamic storage of objects of my pigeon class. Here is my code:
class pigeon {
public:
pigeon(std::string nameI);
void outputInfo();
private:
std::string name;
};
The idea is that I want to be able to add a new object, have a place to store its information, then be able to add another object, and so on. I have no idea where to start with this or even what data structure to use, I have no experience storing objects.
c++ data-structures
I am a beginner to programming and I am trying to find a way to create a dynamic storage of objects of my pigeon class. Here is my code:
class pigeon {
public:
pigeon(std::string nameI);
void outputInfo();
private:
std::string name;
};
The idea is that I want to be able to add a new object, have a place to store its information, then be able to add another object, and so on. I have no idea where to start with this or even what data structure to use, I have no experience storing objects.
c++ data-structures
c++ data-structures
asked Nov 21 at 22:13
NipIsTrue
195
195
4
Are the objects you want to store of the same type? If so you can simply use astd::vector<YourObject>
– Zpalmtree
Nov 21 at 22:14
4
std::vector
– François Andrieux
Nov 21 at 22:15
You need to indicate in your question what you mean by store. Do you mean in memory or something more permanent?
– Kit
Nov 21 at 22:17
As @FrançoisAndrieux already said. Use astd::vector
.
– Jesper Juhl
Nov 21 at 22:37
add a comment |
4
Are the objects you want to store of the same type? If so you can simply use astd::vector<YourObject>
– Zpalmtree
Nov 21 at 22:14
4
std::vector
– François Andrieux
Nov 21 at 22:15
You need to indicate in your question what you mean by store. Do you mean in memory or something more permanent?
– Kit
Nov 21 at 22:17
As @FrançoisAndrieux already said. Use astd::vector
.
– Jesper Juhl
Nov 21 at 22:37
4
4
Are the objects you want to store of the same type? If so you can simply use a
std::vector<YourObject>
– Zpalmtree
Nov 21 at 22:14
Are the objects you want to store of the same type? If so you can simply use a
std::vector<YourObject>
– Zpalmtree
Nov 21 at 22:14
4
4
std::vector
– François Andrieux
Nov 21 at 22:15
std::vector
– François Andrieux
Nov 21 at 22:15
You need to indicate in your question what you mean by store. Do you mean in memory or something more permanent?
– Kit
Nov 21 at 22:17
You need to indicate in your question what you mean by store. Do you mean in memory or something more permanent?
– Kit
Nov 21 at 22:17
As @FrançoisAndrieux already said. Use a
std::vector
.– Jesper Juhl
Nov 21 at 22:37
As @FrançoisAndrieux already said. Use a
std::vector
.– Jesper Juhl
Nov 21 at 22:37
add a comment |
3 Answers
3
active
oldest
votes
up vote
0
down vote
Make vector with pointer of your class:
std::vector<pigeon*> pigeons;
Then allocate new pigeon object and push it into your vector:
pigeon * pig = new pigeon("pigeon");
pigeons.push_back(pig);
1
Is there a reason you suggest using raw owning pointers and adding another level of indirection wherestd::vector<pigeon>
already does what the OP wants?
– Swordfish
Nov 21 at 23:28
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
1
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
2
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use astd::list<std::unique_ptr<pigeon>>
.
– Swordfish
Nov 22 at 0:30
|
show 4 more comments
up vote
0
down vote
As it was already pointed out in the comments, you should preferably use a container that handles its resources following the RAII/RDID-idiom ( "Resource Acquisition Is Initialisation" / "Resource Destruction is Deletion") so you don't have to worry about it yourself. This is also a simple way of preventing resource leaks when an exception is thrown.
One of the commonly used containers of the C++ standard library is std::vector<>
.
You'd use it like this (just to give you an initial idea, please refer to the documentation for further explanation and examples):
#include <vector>
// ...
{
std::vector<pigeon> pigeons;
pigeons.push_back("Karl"); // add three pigeons
pigeons.push_back("Franz"); // at the end of the
pigeons.push_back("Xaver"); // vector
pigeons[1]; // access "Franz"
for(auto /* maybe const */ &p : pigeons) { // iterate over the vector
// do something with pigeon p
}
} // pigeons goes out of scope, its destructor is called which
// takes care of deallocating the memory used by the vector.
add a comment |
up vote
-2
down vote
You can allocate storage using new
like that:
pigeon *pigeon_array = new pigeon[SIZE]
In SIZE you must enter how many elements do you want to store.But dont forget use delete pigeon_array when u will dont need this array anymore.
Or you can use std::vector
or std::array
2
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
@NipIsTrue Then use astd::vector
.
– Jesper Juhl
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421184%2fhow-to-make-a-dynamic-storage-of-objects-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Make vector with pointer of your class:
std::vector<pigeon*> pigeons;
Then allocate new pigeon object and push it into your vector:
pigeon * pig = new pigeon("pigeon");
pigeons.push_back(pig);
1
Is there a reason you suggest using raw owning pointers and adding another level of indirection wherestd::vector<pigeon>
already does what the OP wants?
– Swordfish
Nov 21 at 23:28
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
1
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
2
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use astd::list<std::unique_ptr<pigeon>>
.
– Swordfish
Nov 22 at 0:30
|
show 4 more comments
up vote
0
down vote
Make vector with pointer of your class:
std::vector<pigeon*> pigeons;
Then allocate new pigeon object and push it into your vector:
pigeon * pig = new pigeon("pigeon");
pigeons.push_back(pig);
1
Is there a reason you suggest using raw owning pointers and adding another level of indirection wherestd::vector<pigeon>
already does what the OP wants?
– Swordfish
Nov 21 at 23:28
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
1
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
2
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use astd::list<std::unique_ptr<pigeon>>
.
– Swordfish
Nov 22 at 0:30
|
show 4 more comments
up vote
0
down vote
up vote
0
down vote
Make vector with pointer of your class:
std::vector<pigeon*> pigeons;
Then allocate new pigeon object and push it into your vector:
pigeon * pig = new pigeon("pigeon");
pigeons.push_back(pig);
Make vector with pointer of your class:
std::vector<pigeon*> pigeons;
Then allocate new pigeon object and push it into your vector:
pigeon * pig = new pigeon("pigeon");
pigeons.push_back(pig);
answered Nov 21 at 22:52
kara
576
576
1
Is there a reason you suggest using raw owning pointers and adding another level of indirection wherestd::vector<pigeon>
already does what the OP wants?
– Swordfish
Nov 21 at 23:28
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
1
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
2
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use astd::list<std::unique_ptr<pigeon>>
.
– Swordfish
Nov 22 at 0:30
|
show 4 more comments
1
Is there a reason you suggest using raw owning pointers and adding another level of indirection wherestd::vector<pigeon>
already does what the OP wants?
– Swordfish
Nov 21 at 23:28
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
1
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
2
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use astd::list<std::unique_ptr<pigeon>>
.
– Swordfish
Nov 22 at 0:30
1
1
Is there a reason you suggest using raw owning pointers and adding another level of indirection where
std::vector<pigeon>
already does what the OP wants?– Swordfish
Nov 21 at 23:28
Is there a reason you suggest using raw owning pointers and adding another level of indirection where
std::vector<pigeon>
already does what the OP wants?– Swordfish
Nov 21 at 23:28
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
Op wants to store dynamic objects. When you use vector<pigeon> it first copies the object and stores it. This is not dynamic storing. And some point of view it is not efficient.
– kara
Nov 21 at 23:39
1
1
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
There is always emplace_back() and smart pointers.
– Swordfish
Nov 21 at 23:42
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
Can you give an example of usage of these?
– kara
Nov 21 at 23:46
2
2
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use a
std::list<std::unique_ptr<pigeon>>
.– Swordfish
Nov 22 at 0:30
If copying objects is very expensive, don't copy. There are better ways like having a collection of indexes around that you reorder instead of the objects in the vector. Maybe use a
std::list<std::unique_ptr<pigeon>>
.– Swordfish
Nov 22 at 0:30
|
show 4 more comments
up vote
0
down vote
As it was already pointed out in the comments, you should preferably use a container that handles its resources following the RAII/RDID-idiom ( "Resource Acquisition Is Initialisation" / "Resource Destruction is Deletion") so you don't have to worry about it yourself. This is also a simple way of preventing resource leaks when an exception is thrown.
One of the commonly used containers of the C++ standard library is std::vector<>
.
You'd use it like this (just to give you an initial idea, please refer to the documentation for further explanation and examples):
#include <vector>
// ...
{
std::vector<pigeon> pigeons;
pigeons.push_back("Karl"); // add three pigeons
pigeons.push_back("Franz"); // at the end of the
pigeons.push_back("Xaver"); // vector
pigeons[1]; // access "Franz"
for(auto /* maybe const */ &p : pigeons) { // iterate over the vector
// do something with pigeon p
}
} // pigeons goes out of scope, its destructor is called which
// takes care of deallocating the memory used by the vector.
add a comment |
up vote
0
down vote
As it was already pointed out in the comments, you should preferably use a container that handles its resources following the RAII/RDID-idiom ( "Resource Acquisition Is Initialisation" / "Resource Destruction is Deletion") so you don't have to worry about it yourself. This is also a simple way of preventing resource leaks when an exception is thrown.
One of the commonly used containers of the C++ standard library is std::vector<>
.
You'd use it like this (just to give you an initial idea, please refer to the documentation for further explanation and examples):
#include <vector>
// ...
{
std::vector<pigeon> pigeons;
pigeons.push_back("Karl"); // add three pigeons
pigeons.push_back("Franz"); // at the end of the
pigeons.push_back("Xaver"); // vector
pigeons[1]; // access "Franz"
for(auto /* maybe const */ &p : pigeons) { // iterate over the vector
// do something with pigeon p
}
} // pigeons goes out of scope, its destructor is called which
// takes care of deallocating the memory used by the vector.
add a comment |
up vote
0
down vote
up vote
0
down vote
As it was already pointed out in the comments, you should preferably use a container that handles its resources following the RAII/RDID-idiom ( "Resource Acquisition Is Initialisation" / "Resource Destruction is Deletion") so you don't have to worry about it yourself. This is also a simple way of preventing resource leaks when an exception is thrown.
One of the commonly used containers of the C++ standard library is std::vector<>
.
You'd use it like this (just to give you an initial idea, please refer to the documentation for further explanation and examples):
#include <vector>
// ...
{
std::vector<pigeon> pigeons;
pigeons.push_back("Karl"); // add three pigeons
pigeons.push_back("Franz"); // at the end of the
pigeons.push_back("Xaver"); // vector
pigeons[1]; // access "Franz"
for(auto /* maybe const */ &p : pigeons) { // iterate over the vector
// do something with pigeon p
}
} // pigeons goes out of scope, its destructor is called which
// takes care of deallocating the memory used by the vector.
As it was already pointed out in the comments, you should preferably use a container that handles its resources following the RAII/RDID-idiom ( "Resource Acquisition Is Initialisation" / "Resource Destruction is Deletion") so you don't have to worry about it yourself. This is also a simple way of preventing resource leaks when an exception is thrown.
One of the commonly used containers of the C++ standard library is std::vector<>
.
You'd use it like this (just to give you an initial idea, please refer to the documentation for further explanation and examples):
#include <vector>
// ...
{
std::vector<pigeon> pigeons;
pigeons.push_back("Karl"); // add three pigeons
pigeons.push_back("Franz"); // at the end of the
pigeons.push_back("Xaver"); // vector
pigeons[1]; // access "Franz"
for(auto /* maybe const */ &p : pigeons) { // iterate over the vector
// do something with pigeon p
}
} // pigeons goes out of scope, its destructor is called which
// takes care of deallocating the memory used by the vector.
edited Nov 21 at 23:51
answered Nov 21 at 23:39
Swordfish
1
1
add a comment |
add a comment |
up vote
-2
down vote
You can allocate storage using new
like that:
pigeon *pigeon_array = new pigeon[SIZE]
In SIZE you must enter how many elements do you want to store.But dont forget use delete pigeon_array when u will dont need this array anymore.
Or you can use std::vector
or std::array
2
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
@NipIsTrue Then use astd::vector
.
– Jesper Juhl
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
|
show 1 more comment
up vote
-2
down vote
You can allocate storage using new
like that:
pigeon *pigeon_array = new pigeon[SIZE]
In SIZE you must enter how many elements do you want to store.But dont forget use delete pigeon_array when u will dont need this array anymore.
Or you can use std::vector
or std::array
2
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
@NipIsTrue Then use astd::vector
.
– Jesper Juhl
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
|
show 1 more comment
up vote
-2
down vote
up vote
-2
down vote
You can allocate storage using new
like that:
pigeon *pigeon_array = new pigeon[SIZE]
In SIZE you must enter how many elements do you want to store.But dont forget use delete pigeon_array when u will dont need this array anymore.
Or you can use std::vector
or std::array
You can allocate storage using new
like that:
pigeon *pigeon_array = new pigeon[SIZE]
In SIZE you must enter how many elements do you want to store.But dont forget use delete pigeon_array when u will dont need this array anymore.
Or you can use std::vector
or std::array
answered Nov 21 at 22:35
Fqqlt
1
1
2
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
@NipIsTrue Then use astd::vector
.
– Jesper Juhl
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
|
show 1 more comment
2
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
@NipIsTrue Then use astd::vector
.
– Jesper Juhl
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
2
2
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
Please don't advocate manual memory management in 2018... "Or you can use std::vector or std::array" - Not or, do!
– Jesper Juhl
Nov 21 at 22:38
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
I am don't advocate manual memory management I want to show various ways to make a dynamic storage
– Fqqlt
Nov 21 at 22:42
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
When I mean dynamic I mean like I can add elements too it, so I don't know how many elements I am going to be storing initially
– NipIsTrue
Nov 21 at 22:48
@NipIsTrue Then use a
std::vector
.– Jesper Juhl
Nov 21 at 22:53
@NipIsTrue Then use a
std::vector
.– Jesper Juhl
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
So,you need to use std::vector for that
– Fqqlt
Nov 21 at 22:53
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421184%2fhow-to-make-a-dynamic-storage-of-objects-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Are the objects you want to store of the same type? If so you can simply use a
std::vector<YourObject>
– Zpalmtree
Nov 21 at 22:14
4
std::vector
– François Andrieux
Nov 21 at 22:15
You need to indicate in your question what you mean by store. Do you mean in memory or something more permanent?
– Kit
Nov 21 at 22:17
As @FrançoisAndrieux already said. Use a
std::vector
.– Jesper Juhl
Nov 21 at 22:37