|
Boost Users : |
Subject: Re: [Boost-users] [fusion] .at<N>() template member in containers?
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2010-10-08 09:23:57
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 07 October 2010, OvermindDL1 wrote:
> To be frank, you should *never* have any function be a member function
> unless it absolutely cannot be created externally, you will have
> better compile times, better encapsulation,
In the case he's talking about (similar to Boost.Tuple get()), a template
parameter has to be specified for the function, which means ADL won't work,
so you have to fully qualify a free function call (or use "using"). What's
less annoying to use?
boost::tuples::tuple tup;
tup.get<1>();
or
boost::tuples::get<1>(tup);
> and it prevents you from
> doing nice things like the above.
And of course, adding a member function doesn't prevent anything, it's not an
either-or question. For example, having member swap() methods doesn't
prevent a free-function swap() from existing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkyvG24ACgkQ5vihyNWuA4URbgCgrVSiuhQK+aMudVw+HJEJkNR/
A68AoLhYY3Df/cBz45AKhC2BBgL3GpvD
=Iezo
-----END PGP SIGNATURE-----
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net