Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Global Function Error in Partial Specification?

Reply
Thread Tools

Global Function Error in Partial Specification?

 
 
Nephi Immortal
Guest
Posts: n/a
 
      01-23-2013
I tried to write partial specification on the global function, but the C++ Compiler generates an error. Look at the code and error message below.

1>d:\omega projects\console application\user types\main.cpp(290): error C2182: 'Test' : illegal use of type 'void'
1>d:\omega projects\console application\user types\main.cpp(290): error C2998: 'int Test' : cannot be a template definition
1>d:\omega projects\console application\user types\main.cpp(297): error C2064: term does not evaluate to a function taking 1 arguments

enum class eTypes
{
eA,
eB,
ec
};

template< eTypes eType, typename Integer_Type >
class X
{
private:
public:
template< eTypes eInnerType, typename InnerInteger_Type, InnerInteger_Type Segment >
class Y
{
private:
X< eInnerType, InnerInteger_Type >& reference;

Y( X< eInnerType, InnerInteger_Type >& reference ) : reference( reference )
{
}

~Y()
{
}

Y( const Y< eInnerType, InnerInteger_Type, Segment >& right ) : reference( right.reference )
{
}

Y< eInnerType, InnerInteger_Type, Segment >& operator=( const Y< eInnerType, InnerInteger_Type, Segment >& right )
{
reference.value = right.reference.value;
return *this;
}

Y< eInnerType, InnerInteger_Type, Segment >& operator=( Integer_Type value )
{
reference.value = value;
return *this;
}
};


Integer_Type value;

public:
X( Integer_Type value ) : value( value )
{
}

~X()
{
}

X( const X< eType, Integer_Type >& right ) : value( right.value )
{
}

X& operator=( const X< eType, Integer_Type >& right )
{
value = right.value;
return *this;
}

Y< eType, Integer_Type, 1 > _1() { return Y< eType, Integer_Type, 1 >( *this ); }

};

template< eTypes eInnerType, typename InnerInteger_Type, InnerInteger_Type Segment >
void Test(
const X< eInnerType, InnerInteger_Type >::Y< eInnerType, InnerInteger_Type, Segment >& ref
)
{
}

int main()
{

X< eTypes::eA, int > a = 1;

Test( a._1() );

return 0;
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Partial 1.0 - Partial classes for Python Thomas Heller Python 13 02-08-2007 08:12 PM
Re: Partial 1.0 - Partial classes for Python J. Clifford Dyer Python 0 02-08-2007 05:29 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 1 10-25-2006 06:50 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 0 10-25-2006 01:04 PM
Why? Partial Class within a Partial class Billy ASP .Net 2 02-01-2006 09:10 AM



Advertisments