I still don't really have a full handle on what you are trying to do. But if you are reading out of database tables and passing these records onto processing functions then I would normally create a struct for my data objects from a given table:
1 2 3 4 5 6 7 8 9 10
struct point_table
{
int x;
int y;
int x;
bool active;
bool visible;
};
std::vector<point_table> point_list;
There are various libraries you can find to facilitate extracting and inserting such records from databases.
I still don't really have a full handle on what you are trying to do. But if you are reading out of database tables and passing these records onto processing functions then I would normally create a struct for my data objects from a given table
I think I understand what he wants to do. I'll use your point_table structure example to help make it clear. He doesn't want to get all the data for every record. If he wants, for example, to take the y and visible values, he'll create a vector of ints and a vector of bools, he'll push_back the y values for every record to the first vector and the visible values for every record to the second vector. Then he'll put these two vectors in a vector container and pass this container to his functions for more processing.
EDIT: But then, isn't it necessary to also know what each value stands for? I mean, both active and visible will be put in bool vectors, but I don't think you want to make the same operations on both of them, so you'll have to distinguish them somehow...
But personally I feel doing that is loosing all the benefits of type safety for little gain.
I would prefer to make a struct for each processing function. The processing functions MUST know the type in order to process the info and the routine to extract the data from the database MUST know the type to construct the data object.
So I can't see any gain in organising everything so that the type information gets lost mid-way inviting all kinds of mishaps to scramble the works.
The problem is inherited from the existing code and, as often, the way is to find a solution, or to rewrite the code from scratch. Imagine a GUI where a user can browse a database structure and selects various fields of data of various types from various tables for further processing. Structure of tables is not unified and user's selection is rather none-predictable. Some functions, to which data is passed, are templated, others specialized for concrete data type. Most of tasks, including creation of data containers, intermediary containers, db query, determination of types... should be made at run-time. The amount of data can be huge. Therefore I'm googling for most effective solution to store, manage and return objects of various types. Looks that I'll have to go from scratch with boost libraries, or to switch to a less type-restricted language.