Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Length of C++ arrays allocated by operator new[] Date: Mon, 22 Aug 2011 11:38:13 +1200 Lines: 25 Message-ID: <9bdj75Fr0aU2@mid.individual.net> References: <4e4fb013$0$6568$9b4e6d93@newsspool3.arcor-online.net> <0YKdndDjrZg9f9LTnZ2dnUVZ8jSdnZ2d@giganews.com> <4e516d11$0$7610$9b4e6d93@newsspool1.arcor-online.net> <4e51803e$0$7615$9b4e6d93@newsspool1.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net Dm+GPIAFK8eW4xDZd6hYJgIb38d/PMzGITDu4jrDM6Pow+Ii8l Cancel-Lock: sha1:LQmGV020c0qnuT+Yz4Of8LFp+aU= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:9144 On 08/22/11 11:04 AM, Leigh Johnston wrote: > On 21/08/2011 23:01, Marcel Müller wrote: >> On 21.08.11 23.32, Leigh Johnston wrote: >>> >>> Template code bloat is mostly over stated; non-template classes with >>> lots of inline functions can have similar "bloat". >> >> That's not what I mean. The most bloat comes from different >> instantiations of template classes that in fact produce binary the same >> code. E.g. std::vector will most likely result in identical code for all >> pointer types (except for member function pointers, of course). >> >> At least I have not seen a compiler that can share code between >> different template instantiations. > > That is the price you pay for not having to lose type information > however you can have a std::vector if you want. Template bloat > is less of a concern these days due to increased memory and storage > capacities even on smaller devices such as mobile phones. You don't even gave to loose type safety if you specialise vector for void* and derive privately from there. -- Ian Collins