473,382 Members | 1,710 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,382 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 1309
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.