> 
> I agree that the current functions are awkward to use. I will make the
> input iterator argument optional.
> 

I am having a hard time understanding the use of iterator in wxlua.

I guess an iterator is created by wxString::const_iterator end() or 
wxString::const_iterator begin() for wxString which would be coded 
wx.wxString(str):end() but end is a reserve word in Lua. I guess end could be 
renamed.

the code would be
date:ParseDate(aa,  wx.wxString_const_iterator(aa:end()) )
since aa:end()returns a wxString_iterator

Note: that using begin() give unexpected results

aa = wx.wxString("09-06-2012")
print(date:ParseDate(aa, wx.wxString_const_iterator(aa:begin())))
aa = wx.wxString("")
print(date:ParseDate(aa, wx.wxString_const_iterator(aa:begin())))

display:
true
false

I would have expected both of these to be identical.

--------------------------------------------------------

Are iterators useful in wxLua? The addition in wxWidget maybe justified for 
saving copying of strings in a tight loop but most of the time C++ programmer 
will replace their code in the following way and live with the overhead.

old code: foo(v) 
new code: foo(v,&(type::const_iterator)v.end) // would not compile purely for 
illustration.

In wxLua using foo(v) or foo(string.match(v,pattern)) seems so much simpler 
than 
using an iterator.

ParseDate is not the only function using iterator but all of them seem similar.

Thank you.
Andre


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to