Opened 13 years ago

Closed 12 years ago

#3326 closed Bugs (wontfix)

struct tagging in constructor stops conditional construction without .swap call

Reported by: Andy Schneider <andrew.schneider@…> Owned by: Ion Gaztañaga
Milestone: Boost 1.40.0 Component: interprocess
Version: Boost 1.39.0 Severity: Cosmetic
Keywords: Cc:

Description

I'd like to do this:

shared_memory_object shm_obj

(isOwner ? create_only : open_only ,"shared_memory" name ,read_write read-write mode );

but I don't seem to be able to because create_only and open_only are tag structs.

Instead I end up with something like this:

shared_memory_object shm;

if (isOwner) {

shared_memory_object shm_obj (...) shm_obj.swap (shm);

} else {

shared_memory_object shm_obj (...) shm_obj.swap (shm);

}

which isn't as clean imho. What's the rational for a tag struct rather than enum?

Change History (1)

comment:1 by Ion Gaztañaga, 12 years ago

Resolution: wontfix
Status: newclosed

This is not a bug. Maybe annoying for some but there are no more annoyance reports on this.

Note: See TracTickets for help on using tickets.