In the following code I have placed anonymous structures inside of my class declaration to hopefully improve the readability of it.
class example {
private:
struct barrier {
boost::barrier playlist_avaliable;
boost::barrier display_sync;
barrier( ) : playlist_avaliable( 2 ), display_sync( 3 ) { }
} barrier;
public:
example( ) { }
void playlist_avaliable( ) {
barrier.playlist_avaliable.wait();
}
};
Is this any better than the alternative of having variables with names like ‘barrier_playlist_avaliable’?
Ok, some random thoughts:
struct. It is redundant.
barely more than syntactic sugar. It
is a nice way to group variables.
influenced by the question how much
transparent the inner struct should
be to the class example. For example, do you want the members of the struct to initialized in the constructor of example?