Unusal use of using keyword

Hi All,

I am trying to get involved in the open source community and have offered to participate in a project, downloaded it and tried to go over the code and I have come across something I have never seen that is throwing a compile error (I may not have setup the project correctly yet with all the necessary lib references, so at the moment I am thinking the original developer is right and I am doing something wrong).

I can see the intent but still don't understand how it is a valid statement, and I am sure I am just missing something.

I know the using keyword is normally used in terms of namespaces but I have never seen an assignment operator included in the statement, the format of the declaration is as follows in the hh or declaration file of a class:

namespace A
class foo
.... some normal class constructors, functions etc.
// This next line I don't understand that doesn't compile.
using boo = foo* (*)();
// I think the intention is to create a keyword/macro as a type of
// polymorphism constructor, but:
// 1. foo is not a namespace but a class
// 2. I didn't think the using keyword in C++ would support such a statement?

Thanks in advance


// These two are equvalent
typedef int foo ;
using foo = int ;

// These two are equvalent
typedef foo* function_type() ;
using function_type = foo*() ;

// These four are equvalent
typedef function_type* boo ;
using boo = function_type* ;
typedef foo* (*boo)() ;
using boo = foo* (*)() ;

See: http://en.cppreference.com/w/cpp/language/type_alias
Thanks JLBorges,

Gave me the necessary information I needed to discover I needed to update the compiler, have not been keeping up with the new C++.

Seems like I have to get the gcc compiler to version 4.7.2 which I have downloaded but is going to take a bit of fiddling around to get it installed.
Topic archived. No new replies allowed.