Thread: C++0x Concepts fall

  1. #31
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #32
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Quote Originally Posted by Elysia View Post
    Meh, it has two different purposes.
    1) Import a specific type into the global namespace (ie use std::cout).
    Into any namespace. You can do this:
    Code:
    namespace foo { void x(); }
    namespace bar { using foo::x; }
    void f() { bar::x(); }
    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.

    2) Create a namespace alias (ie using l = boost::lambda).
    No, you do that using namespace:
    Code:
    namespace ll = boost::lambda;
    namespace fs = boost::filesystem;
    3) Create a type alias (ie template<typename T> using Vec = std::vector).
    That one is new in C++0x.

    There's more.
    4) Make names from a base class visible in the derived class despite overloading:
    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.
    };
    5) Change access of inherited elements, especially inherited from private bases:
    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

  3. #33
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Re 2): Oh yes, my bad. I don't know what I was thinking...
    And I forgot 1). I've seen it, of course.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 08-31-2004, 06:41 PM
  2. Programming concepts
    By lyx in forum C++ Programming
    Replies: 2
    Last Post: 12-03-2003, 12:37 AM
  3. Independent & Effeciency :: Programming Concepts
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 06-08-2002, 05:08 AM
  4. Basic 2d Programming Concepts
    By JoshG in forum Game Programming
    Replies: 4
    Last Post: 05-17-2002, 05:54 AM
  5. Microsoft Fall?
    By Sekti in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 02-25-2002, 04:21 PM