On Jun 7, 7:10*am, sumsin <sumsin...@gmail.com> wrote:
> On Jun 7, 11:00 am, Daniel Pitts
>
>
>
>
>
> <newsgroup.spamfil...@virtualinfinity.net> wrote:
> > sumsin wrote:
> > > On Jun 7, 6:48 am, Daniel Pitts
> > > <newsgroup.spamfil...@virtualinfinity.net> wrote:
> > >> I've created a class with semantics such that it makes sense to call
> > >> std::abs(foo) and get a (double) result.
>
> > >> Is it sensible to add to the std namespace, or would it be better to put
> > >> an "abs" function it in the same namespace as my class was created?
>
> > >> --
> > >> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
>
> > > No it wouldn't be good.
>
> > Thanks for the ambiguous response, it's very helpful.
>
> > Which wouldn't be good, and more importantly, *why*?
>
> > --
> > Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
>
> because std namespace is meant for standard utilities and your
> semantics for 'abs' function is not standard from the language
> perspective thats why i am suggesting no. So keep it into your custom
> namespace.
Or you could do:
namespace super_std {
using namespace std;
/* Put more stuff here */
}
|