|
Boost Users : |
Subject: Re: [Boost-users] Can not compile a program that uses typeof package by gcc?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-22 12:40:58
AMDG
Peng Yu wrote:
> This is a reasonable solution. But no matter which namespace
> multiply_traits puts, it pollutes that namespace. Since namespace is a
> way to better organized the code, I'd rather multiply_traits be in the
> same namespace as that of its associated types.
>
A generic multiply_traits is not tied to any specific type.
You can always put it in a detail namespace.
> Since Koenig lookup can be used to deduce the namespace of a function
> based on whether its arugments are from, I'm wondering why C++ does
> not allow such look up for templates? If Koenig lookup can be used
> for template, then the problem is solved.
>
That would cause worse problems. Koenig lookup can
cause obscure, hard to find bugs in generic code, when the
wrong function is called.
In Christ,
Steven Watanabe
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