![]() |
Custom swap in std namespace
Is it well formed C++ to define free swap function for my custom container
in std namespace? cheers, Marcin |
Re: Custom swap in std namespace
Marcin Kalicinski wrote:
> Is it well formed C++ to define free swap function for my custom container > in std namespace? Yes. You are allowed to _specialise_ any of 'std' templates for your particular types. V |
Re: Custom swap in std namespace
Victor Bazarov wrote:
> Marcin Kalicinski wrote: > >> Is it well formed C++ to define free swap function for my custom >> container in std namespace? > > > Yes. You are allowed to _specialise_ any of 'std' templates for your > particular types. > > V So, the first of the following two functions is OK, but not the second, since the second is an overload and not a specialization? class MyClass; namespace std { template<> void swap<MyClass>(MyClass&, MyClass&); } namespace std { void swap(MyClass&, MyClass&); } |
| All times are GMT. The time now is 09:44 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.