c++.stlsoft - Converting from winstl::a2w to 'const unsigned short *' on MSVC++8
- Adi Shavit <adish gentech.co.il> Mar 29 2007
- "Matthew Wilson" <matthew hat.stlsoft.dot.org> Mar 29 2007
- "Matthew Wilson" <matthew hat.stlsoft.dot.org> Mar 29 2007
- Adi Shavit <adish gentech.co.il> Mar 30 2007
- "Matthew Wilson" <matthew hat.stlsoft.dot.org> Mar 30 2007
- Adi Shavit <adish gentech.co.il> Mar 30 2007
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <font face="Verdana">Hi,<br> <br> I'm getting this compilation error on MSVC++ 2005:<br> <br> </font> <blockquote><tt>h:\adish\dev\audiostream\audiostream\audiostream\audiostream.hpp(56) : error C2664: 'std::streamsize audiostream::audio_sink<SinkType>::write(const unsigned short *,std::streamsize)' : <font color="#cc0000"><b>cannot convert parameter 1 from 'stlsoft::winstl_project::multibyte2wide<CCH>' to 'const unsigned short *'</b></font><br> with<br> [<br> SinkType=boost::iostreams::sink<br> ]<br> and<br> [<br> CCH=256<br> ]<br> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called</tt><br> </blockquote> <font face="Verdana"><br> See context <a href="http://www.codeproject.com/audio/audio_ostream.asp?msg=1965489#xx1965489xx">here</a>.<br> Essentially I try to pass a </font><b><tt>winstl::a2w()</tt></b><font face="Verdana"> to a method expecting </font><tt><b>const unsigned short* s</b></tt><font face="Verdana">.<br> It works fine on MSVC++6.<br> <br> Any thoughts?<br> Thanks,<br> Adi<br> </font> </body> </html>
Mar 29 2007
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
The problem is not with multibyte2wide.
It's that your write() method takes 'unsigned char const*', whereas =
winstl::multibyte2wide's char type is 'wchar_t'. On VC6 these are the =
same (because wchar_t is a typedef); on VC8 these are different because =
wchar_t is a full-fledged type.
:-)
"Adi Shavit" <adish gentech.co.il> wrote in message =
news:euh6qd$4mi$1 digitalmars.com...
Hi,
I'm getting this compilation error on MSVC++ 2005:
h:\adish\dev\audiostream\audiostream\audiostream\audiostream.hpp(56) =
: error C2664: 'std::streamsize =
audiostream::audio_sink<SinkType>::write(const unsigned short =
*,std::streamsize)' : cannot convert parameter 1 from =
'stlsoft::winstl_project::multibyte2wide<CCH>' to 'const unsigned short =
*'
with
[
SinkType=3Dboost::iostreams::sink
]
and
[
CCH=3D256
]
No user-defined-conversion operator available that can =
perform this conversion, or the operator cannot be called
See context here.
Essentially I try to pass a winstl::a2w() to a method expecting const =
unsigned short* s.
It works fine on MSVC++6.
Any thoughts?
Thanks,
Adi
Mar 29 2007
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0150_01C7729C.D24C5130"
------=_NextPart_001_0150_01C7729C.D24C5130
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
The question is, I think, why the wide string write() is not 'wchar_t =
const*'?
If it has to be for some reason, then you're going to need to do some =
casting. Included is a modified form of your audiostream.hpp that fixes =
it (and compiles with VC8).
If it doesn't, then it's a real simple fix.
"Matthew Wilson" <matthew hat.stlsoft.dot.org> wrote in message =
news:euha08$84t$1 digitalmars.com...
The problem is not with multibyte2wide.
It's that your write() method takes 'unsigned char const*', whereas =
winstl::multibyte2wide's char type is 'wchar_t'. On VC6 these are the =
same (because wchar_t is a typedef); on VC8 these are different because =
wchar_t is a full-fledged type.
:-)
"Adi Shavit" <adish gentech.co.il> wrote in message =
news:euh6qd$4mi$1 digitalmars.com...
Hi,
I'm getting this compilation error on MSVC++ 2005:
=
h:\adish\dev\audiostream\audiostream\audiostream\audiostream.hpp(56) : =
error C2664: 'std::streamsize =
audiostream::audio_sink<SinkType>::write(const unsigned short =
*,std::streamsize)' : cannot convert parameter 1 from =
'stlsoft::winstl_project::multibyte2wide<CCH>' to 'const unsigned short =
*'
with
[
SinkType=3Dboost::iostreams::sink
]
and
[
CCH=3D256
]
No user-defined-conversion operator available that can =
perform this conversion, or the operator cannot be called
See context here.
Essentially I try to pass a winstl::a2w() to a method expecting =
const unsigned short* s.
It works fine on MSVC++6.
Any thoughts?
Thanks,
Adi
------=_NextPart_001_0150_01C7729C.D24C5130
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2800.1589" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>The question is, I think, why the wide =
string=20
write() is not 'wchar_t const*'?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>If it has to be for some reason, then =
you're going=20
to need to do some casting. Included is a modified form of your =
audiostream.hpp=20
that fixes it (and compiles with VC8).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>If it doesn't, then it's a real simple=20
fix.</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Matthew Wilson" <<A=20
=
href=3D"mailto:matthew hat.stlsoft.dot.org">matthew hat.stlsoft.dot.org</=
A>>=20
wrote in message <A=20
=
href=3D"news:euha08$84t$1 digitalmars.com">news:euha08$84t$1 digitalmars.=
com</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>The problem is not with=20
multibyte2wide.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>It's that your write() method takes =
'unsigned=20
char const*', whereas winstl::multibyte2wide's char type is 'wchar_t'. =
On VC6=20
these are the same (because wchar_t is a typedef); on VC8 these are =
different=20
because wchar_t is a full-fledged type.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN id=3DintelliTXT=20
name=3D"intelliTxt">:-)</DIV></SPAN></FONT>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Adi Shavit" <<A=20
href=3D"mailto:adish gentech.co.il">adish gentech.co.il</A>> =
wrote in=20
message <A=20
=
href=3D"news:euh6qd$4mi$1 digitalmars.com">news:euh6qd$4mi$1 digitalmars.=
com</A>...</DIV><FONT=20
face=3DVerdana>Hi,<BR><BR> I'm getting this compilation error =
on MSVC++=20
2005:<BR><BR></FONT>
=
<BLOCKQUOTE><TT>h:\adish\dev\audiostream\audiostream\audiostream\audiostr=
eam.hpp(56)=20
: error C2664: 'std::streamsize=20
audiostream::audio_sink<SinkType>::write(const unsigned =
short=20
*,std::streamsize)' : <FONT color=3D#cc0000><B>cannot convert =
parameter 1=20
from 'stlsoft::winstl_project::multibyte2wide<CCH>' to =
'const=20
unsigned short =
*'</B></FONT><BR> =20
with<BR> =20
=
[<BR> =20
=
SinkType=3Dboost::iostreams::sink<BR> =
=20
]<BR> =20
and<BR> =20
=
[<BR> =20
CCH=3D256<BR> =20
]<BR> No =
user-defined-conversion=20
operator available that can perform this conversion, or the =
operator=20
cannot be called</TT><BR></BLOCKQUOTE><FONT face=3DVerdana><BR>See =
context <A=20
=
href=3D"http://www.codeproject.com/audio/audio_ostream.asp?msg=3D1965489#=
xx1965489xx">here</A>.<BR>Essentially=20
I try to pass a </FONT><B><TT>winstl::a2w()</TT></B><FONT =
face=3DVerdana> to a=20
method expecting </FONT><TT><B>const unsigned short* s</B></TT><FONT =
face=3DVerdana>.<BR>It works fine on MSVC++6.<BR><BR>Any=20
=
thoughts?<BR>Thanks,<BR>Adi<BR></BLOCKQUOTE></BLOCKQUOTE></FONT></BODY></=
HTML>
------=_NextPart_001_0150_01C7729C.D24C5130--
Mar 29 2007
Hi,The question is, I think, why the wide string write() is not 'wchar_t const*'?
In fact, once I changed it to wchar_t it works on both VS6 and VS2005.If it has to be for some reason, then you're going to need to do some casting. Included is a modified form of your audiostream.hpp that fixes it (and compiles with VC8). If it doesn't, then it's a real simple fix.
Adi
Mar 30 2007
Cool. I suspected it might. :-) "Adi Shavit" <adish gentech.co.il> wrote in message news:eujqtc$4kn$1 digitalmars.com...Hi,The question is, I think, why the wide string write() is not 'wchar_t const*'?
In fact, once I changed it to wchar_t it works on both VS6 and VS2005.If it has to be for some reason, then you're going to need to do some casting. Included is a modified form of your audiostream.hpp that fixes it (and compiles with VC8). If it doesn't, then it's a real simple fix.
Adi
Mar 30 2007
The problem is not with multibyte2wide.
It's that your write() method takes 'unsigned char const*', whereas winstl::multibyte2wide's char type is 'wchar_t'. On VC6 these are the same (because wchar_t is a typedef); on VC8 these are different because wchar_t is a full-fledged type.
was my oversight integrating with Boost Iostreams. Thanks, Adi
Mar 30 2007









"Matthew Wilson" <matthew hat.stlsoft.dot.org> 