Meh, it has two different purposes.
1) Import a specific type into the a namespace (ie use std::cout).
3) Create a type alias (ie template<typename T> using Vec = std::vector).
This is a discussion on C++0x Concepts fall within the General Discussions forums, part of the Community Boards category; Meh, it has two different purposes. 1) Import a specific type into the a namespace (ie use std::cout). 3) Create ...
Meh, it has two different purposes.
1) Import a specific type into the a namespace (ie use std::cout).
3) Create a type alias (ie template<typename T> using Vec = std::vector).
Last edited by Elysia; 07-27-2009 at 02:32 AM.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Into any namespace. You can do this:
This is quite often useful, e.g. many Boost libraries define most of their symbols in a library-specific namespace and lift a few important names into the boost namespace.Code:namespace foo { void x(); } namespace bar { using foo::x; } void f() { bar::x(); }
No, you do that using namespace:2) Create a namespace alias (ie using l = boost::lambda).
Code:namespace ll = boost::lambda; namespace fs = boost::filesystem;That one is new in C++0x.3) Create a type alias (ie template<typename T> using Vec = std::vector).
There's more.
4) Make names from a base class visible in the derived class despite overloading:
5) Change access of inherited elements, especially inherited from private bases:Code:struct Base { virtual void f(int); virtual void f(float); }; struct Derived : public Base { virtual void f(int); // Override (int) version. using Base::f; // But let the compiler still find the (float) version. };
Code:class Whatever : private std::vector<int> { public: typedef std::vector<int>::iterator iterator; typedef std::vector<int>::const_iterator const_iterator; using std::vector<int>::begin; using std::vector<int>::end; };
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Re 2): Oh yes, my bad. I don't know what I was thinking...
And I forgot 1). I've seen it, of course.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^