Wrox Programmer Forums
|
BOOK: Ivor Horton's Beginning Visual C++ 2010
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2010 by Ivor Horton; ISBN: 9780470500880
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2011, 02:52 PM
Registered User
 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to eng/elsayed
Arrow about sketcher examble ch 17 MFC

CSketcherDoc::~CSketcherDoc(void)
{
// Delete the element pointed to by each list entry
for(auto iter = m_ElementList.begin() ; iter != m_ElementList.end() ; ++iter)
delete *iter;
m_ElementList.clear(); // Finally delete all pointers
}


the compiler does not accept the keyword auto
i work on vs 2008
what's wrong with that because its repeated lot in the program and i stopped working
 
Old December 19th, 2011, 02:08 PM
Authorized User
 
Join Date: Oct 2011
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by eng/elsayed View Post
CSketcherDoc::~CSketcherDoc(void)
{
// Delete the element pointed to by each list entry
for(auto iter = m_ElementList.begin() ; iter != m_ElementList.end() ; ++iter)
delete *iter;
m_ElementList.clear(); // Finally delete all pointers
}


the compiler does not accept the keyword auto
i work on vs 2008
what's wrong with that because its repeated lot in the program and i stopped working
Hi eng/elsayed!
I am using Visual Studio 10 and I put your code into my project. It says that the auto keyword isn't legal there. In order for the auto keyword to function in it's new role, it needs to be able to deduce from the rest of the statement what the type of the variable is. In this case, it is not able to. I have tried these kind statements before without success. It's sort of a trial and error process for me. I'll try to see if it will work and if it does, I'll start using it in that situation.

Hope this helps!
golfer43
 
Old March 20th, 2012, 07:41 PM
Registered User
 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to declare iter first:

std::list<CElement*>::const_iterator iter;





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 17 LINQ to SQL sirmilt BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 0 May 29th, 2011 05:37 PM
CH 17 - Assemblies equintana71 BOOK: Professional C# 2008 ISBN: 978-0-470-19137-8 1 May 17th, 2011 09:20 PM
Anyone make it to ch 15 the sketcher program? datanewb BOOK: Ivor Horton's Beginning Visual C++ 2010 1 June 10th, 2010 01:16 PM
ch 13 - sketcher menu problem zamontgo BOOK: Ivor Horton's Beginning Visual C++ 2005 0 May 24th, 2008 10:11 PM
IStateManager.TrackViewState() Ch 17 EdKroket BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 January 25th, 2007 07:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.