Can any function be a remote function?

The working draft explicitly states that the default functions must be special member functions (for example, copy-constructor, default-constructor, etc. (§8.4.2.1-1)). It makes sense.

However, I do not see such a restriction for remote functions (§8.4.3). Is it correct?

Or, in other words, are these three examples valid c++0?

struct Foo
{
   // 1
   int bar( int ) = delete;
};


// 2
int baz( int ) = delete;


template< typename T >
int boo( T t );

// 3
template<>
int boo<int>(int t) = delete;
+5
source share
3 answers

The C ++ 0x specification (& sect; [dcl.fct.def.delete]) does not prohibit such constructs, and g ++ 4.5 recognizes all 3 of them.

x.cpp: In function 'int main()':
x.cpp:4:8: error: deleted function 'int Foo::bar(int)'
x.cpp:21:11: error: used here
x.cpp:9:5: error: deleted function 'int baz(int)'
x.cpp:22:2: error: used here
x.cpp:9:5: error: deleted function 'int baz(int)'
x.cpp:22:8: error: used here
x.cpp:17:5: error: deleted function 'int boo(T) [with T = int]'
x.cpp:23:7: error: used here
+4
source

I think that everything is in order.

= delete , (§8.4.3/2), .

5 ... delete . , : " - ". -, , . .

,

class abc {
protected:
    inline virtual ~abc() = 0;
    inline virtual void do_something() = 0;
};

abc::~abc() {}
void abc::do_something = delete;

= 0 = delete . = delete abc::do_something().

, ++ ++ 0x .

+4

, "" -, , - (, , ), , - ( , "", )

-3

All Articles