FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
August 01, 2003

Generalized String Manipulation: Access Shims and Type Tunneling

(Page 15 of 20)
Koenig Lookup, Includes and Namespaces

Koenig Lookup, Includes and Namespaces

If all the types for which the shim you're using is defined are user-defined types, and are defined within the namespaces of their "shimmed" type, and the compiler(s) you are using support(s) Koenig lookup, then you do not need to specify any using declarations, and the whole thing works like a treat. Unfortunately, this being the real world, many compilers do not fully implement Koenig lookup, and we often want to define shims to include basic types and those defined within the global namespace. In such cases, we therefore need to use using declarations between the declaration of the types and the algorithms, classes or client code that is implemented in terms of the shims. The majority of the time this is simple both to do and to understand, but there are occasional confusions when dealing with heavily derivative code. In the long run, it'd be nice for popular shims (such as get_ptr and c_str_ptr/c_str_len) to be declared and defined in the namespace along their requisite types, including those in the global namespace (e.g., char const *) and the standard library (e.g., std::basic_string<>). Unless and until the C++ community buys in to the shims idea, however, you'll need to bear in mind that you may have to "use" them to use them.

Previous Page | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK