Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

Interface Copy Policy in dotnet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
zhp80@sina.com - 22 Feb 2005 08:04 GMT
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\VideoSampleDevices.h(28) : error
C2061: syntax error: identifier ??SourceType??
....................

Thanks.

zhp80.Townee
Kim Gräsman - 22 Feb 2005 09:32 GMT
Hi zhp80.Townee,

>  typename ContainerType::value_type SourceType;
>
> f:\VideoMonitor.ZHP\VideoSampleDevice\VideoSampleDevices.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/html/_langref_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.

Signature

Best regards,
Kim Gräsman

adebaene@club-internet.fr - 22 Feb 2005 09:38 GMT
<z...@sina.com> wrote:
> My collection need to upgrade to dotnet. It is right in vc6, but is error in
> vc7.net
[quoted text clipped - 27 lines]
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.