Author: Roman.PerepelitsaRoman.Perepelitsa Date: Dec 18, 2007 08:58
> One thing that would help me a lot in code would be something that allowed
> me to iterate through the members of a class or structure. Consider
> serialization.
>
> To serialize a class or structure I need to serialze each type (not hard)
> then in the class serialize each variable. For a simple structure, such as
> holding integers and std::strings, if there was some way to iterate through
> the variables it would be simple something like in pseudo code:
>
> std::ostream& operator<<( std::ostream& os)
> {
> for_each_member( os << member );
>
> }
>
> There is also a case where I want to tie a structure/class into a database
> and need to go through each variable and call a function to tie it in, a
> simple thing if there was a way to call something for each variable.
> ...
|