473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Interface Copy Policy in dotnet

My collection need to upgrade to dotnet. It is right in vc6, but is error in
vc7.net

following is code:
template <class ContainerType, class InterfaceType>
class InterfaceCopy
{
public :
typedef ContainerType::value_type SourceType;

static void init(InterfaceType** p)
{
_CopyInterface<InterfaceType>::init(p);
}

static void destroy(InterfaceType** p)
{
_CopyInterface<InterfaceType>::destroy(p);
}

static HRESULT copy(InterfaceType** pTo, SourceType* pFrom)
{
return _CopyInterface<InterfaceType>::copy(pTo, (&(pFrom->second)));
}

}; // class Interface Copy Policy

Change
typedef ContainerType::value_type SourceType;
to
typename ContainerType::value_type SourceType;

f:\VideoMonitor.ZHP\VideoSampleDevice\VideoSampleD evices.h(28) : error
C2061: syntax error: identifier ¡°SourceType¡±
.....................

Thanks.

zhp80.Townee
Nov 17 '05 #1
2 1311
Hi zhp80.Townee,
typename ContainerType::value_type SourceType;

f:\VideoMonitor.ZHP\VideoSampleDevice\VideoSampleD evices.h(28) : error
C2061: syntax error: identifier ¡°SourceType¡±


I don't think typename is legal here... Or it is, but it makes SourceType an instance of ContainerType::value_type. See
http://msdn.com/library/en-us/vclang...f_typename.asp

Of course, I'm no language expert, so it could be that I'm overlooking something, but I'd change it to a typedef if I were you.

--
Best regards,
Kim Gräsman
Nov 17 '05 #2

<z...@sina.com> wrote:
My collection need to upgrade to dotnet. It is right in vc6, but is error in vc7.net

following is code:
template <class ContainerType, class InterfaceType>
class InterfaceCopy
{
public :
typedef ContainerType::value_type SourceType;

static void init(InterfaceType** p)
{
_CopyInterface<InterfaceType>::init(p);
}

static void destroy(InterfaceType** p)
{
_CopyInterface<InterfaceType>::destroy(p);
}

static HRESULT copy(InterfaceType** pTo, SourceType* pFrom)
{
return _CopyInterface<InterfaceType>::copy(pTo, (&(pFrom->second))); }

}; // class Interface Copy Policy

Change
typedef ContainerType::value_type SourceType;
to
typename ContainerType::value_type SourceType;


Use typedef typename ContainerType::value_type SourceType;

You're still defining a typedef (SourceType), but the definition of
this typedef is a dependent type, and therefore the compiler needs to
be told that ContainerType::value_type is a type.

Arnaud
MVP - VC

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
4
by: Roy Pereira | last post by:
I have an application that is composed of a set of "Content" dlls and a viewer application. The viewer calls a standard set of functions that are present in all the dlls. I maintain this by...
0
by: Jack | last post by:
I am working on a dotnet project to write an application that can audit and write registry and local security policy entries on multiple standalone (not networked) and domain computers. Since...
4
by: Chris Thunell | last post by:
Where in GroupPolicy can you adjust DotNet framework security? Thanks! cthunell@pierceassociates.com Chris Thunell
3
by: Pol Bawin | last post by:
A class has a private field of type IWizard (An interface) and a public property to access it. When I try to serialize the Geometry class in XML, i have an error but it works in Binary Can...
0
by: | last post by:
My collection need to upgrade to dotnet. It is right in vc6, but is error in vc7.net following is code: template <class ContainerType, class InterfaceType> class InterfaceCopy { public :...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
2
by: Venkat Venkataramanan | last post by:
Hello: I have an object Users that implements the ICloneable interface. I am trying to pass an instance of this object, foUser from one form into a second form ByRef. Dim formLogin As New...
2
by: josephm | last post by:
Hello Group: My first post on the group.Hope I get a response. I have a modest Fire Insurance ACCES Db.Thanks to this group - for the code. A "wanna be programmer"... "LEARNS" The code...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.