For Programmers: Free Programming Magazines  


Home > Archive > VC STL > February 2005 > Re: BUG: "const _Ty&" vs "const_reference"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: BUG: "const _Ty&" vs "const_reference"
Gene Bushuyev

2005-02-14, 9:11 pm

....
> You are right. But it would have been nice if the containers could have
> supported this (at the programmer's risk).


(Some) Compilers don't notice (some) situations when objects with non-const
copy ctors are used. It's not a good thing. Containers may make copies of the
objects they contain and the standard requires that those copies are the
"same" and implementation may depend on that. For examples of nasty behavior
followed such use see Herb Sutter books. Some sort of shared_ptr is a usual
solution.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com