Boost C++ Libraries: Ticket #3326: struct tagging in constructor stops conditional construction without .swap call https://svn.boost.org/trac10/ticket/3326 <p> I'd like to do this: </p> <blockquote> <p> shared_memory_object shm_obj </p> <blockquote> <p> (isOwner ? create_only : open_only ,"shared_memory" <em>name ,read_write </em>read-write mode ); </p> </blockquote> </blockquote> <p> but I don't seem to be able to because create_only and open_only are tag structs. </p> <p> Instead I end up with something like this: </p> <p> shared_memory_object shm; </p> <p> if (isOwner) { </p> <blockquote> <p> shared_memory_object shm_obj (...) shm_obj.swap (shm); </p> </blockquote> <p> } else { </p> <blockquote> <p> shared_memory_object shm_obj (...) shm_obj.swap (shm); </p> </blockquote> <p> } </p> <p> which isn't as clean imho. What's the rational for a tag struct rather than enum? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3326 Trac 1.4.3 Ion Gaztañaga Thu, 26 Aug 2010 11:41:50 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3326#comment:1 https://svn.boost.org/trac10/ticket/3326#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> This is not a bug. Maybe annoying for some but there are no more annoyance reports on this. </p> Ticket