C++0x Concepts fall

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 ...

  1. #31
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    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,893
    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,543
    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.

Page 3 of 3 FirstFirst 123
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-02-2003, 11:37 PM
  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, 03:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21