Boost logo

Boost :

Subject: Re: [boost] [function_types] Number of default parameters
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2011-02-13 22:09:00


[Lorenzo Caminiti]
> Also, are the function parameter storage classifiers `auto` and
> `register` part of the function type? Can I manipulate (check, add,
> and remove) them at compile-time using template metafunctions?

> The expression `typedef int (f_type)(auto int x, register bool y);`
> complies on both GCC and MSVC so maybe they are part of the function
> type...

auto's dead. As for register, I'm not a Core Language guru and I can't find Standardese saying anything one way or the other (I see the Standardese that drops top-level cv-qualifiers), but both VC10 RTM and GCC 4.5.2 appear to believe that register does *not* affect the function type:

C:\Temp>type meow.cpp
#include <ios>
#include <iostream>
#include <ostream>
#include <typeinfo>
#include <type_traits>
using namespace std;

int main() {
    cout << boolalpha;
    cout << typeid(void (int, register int)).name() << endl;
    cout << is_same<void (int, register int), void (int, int)>::value << endl;
}

C:\Temp>cl /EHsc /nologo /W4 meow.cpp && meow
meow.cpp
void __cdecl(int,int)
true

C:\Temp>g++ -Wall -Wextra -std=c++0x meow.cpp -o meow.exe && meow
FviiE
true

C:\Temp>c++filt -t FviiE
void (int, int)

STL


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk