namespace system_one {
struct ID {
int unique_id;
int inner_index;
};
namespace {
struct item {
// some stuff
};
map< ID, item > items; // where the real data stored
ID get_new_id(){
// some code generating a blank new id and a blank item
}
}
ID add_item( const Property& property ){
ID new_id = get_new_id();
// initilizing the the new data
return new_id;
}
void apply_some_change( Id id ){
// apply some change to the target id
}
}
namespace system_one {
namespace {
struct item {
// some stuff
};
map< ID, item > items; // where the real data stored
ID get_new_id(){
// some code generating a blank new id and a blank item
}
}
struct ID {
int unique_id;
int inner_index;
void apply_some_change(){
// do something changes
// by accessing the unnamed namespace from here
}
};
ID add_item( const Property& property ){
ID new_id = get_new_id();
// initilizing the the new data
return new_id;
}
}
I think both work,
Just want to know which is better ??
Or maybe both are wrong ?