|
Er, I do not understand completely your question. copy will work the same for basic_string<TCHAR> s, except that what it copies are TCHAR s instead of char s. copy does ont have anything to do with copying from one basic_string to another.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks...i get it now
|
|
|
|
|
Hi all,
When I compile this very simple program I get some warnings... but I don't know why? Here is this program:
int i = 0;
std::vector<std::string> str_vect1;
std::vector<std::string> str_vect2;
std::vector<std::string>::iterator it1;
std::vector<std::string>::iterator it2;
str_vect1.resize(5);
for(it1 = str_vect1.begin(), i = 0; it1 != str_vect1.end(); it1++, i++)
{
cout << "str_vect1[" << i << "] = ";
cin >> *it1;
}
str_vect2.resize(str_vect1.size());
for(it1 = str_vect1.begin(), it2 = str_vect2.begin(); it1 != str_vect1.end(); it1++, it2++)
{
*it2 = *it1;
}
for(it2 = str_vect2.begin(), i = 0; it2 != str_vect2.end(); it2++, i++)
{
cout << "str_vect2[" << i << "] = " << *it2 << endl;;
}
I don't understand these warnings...
Compiling...
DebugApp.cpp
C:\KINDT\My Projects VC++\Chameleon Project\GENERIC SELDES DRIVER\DebugApp\DebugApp.cpp(87) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<
char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug
information
C:\KINDT\My Projects VC++\Chameleon Project\GENERIC SELDES DRIVER\DebugApp\DebugApp.cpp(87) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,
std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(39) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\vector(60) : warning C4786: 'std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >
>::~vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
Linking...
DebugApp.exe - 0 error(s), 4 warning(s)
Thanks for all who can help me...
Hello World!!!
from Raphaël
|
|
|
|
|
Don't worry about it, it's a confirmed (and harmless) bug in MSVC++ 6.0. To get rid of it, insert the following line at the beginning of your .cpp :
#pragma warning(disable:4786) Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks a lot for your reply...
Hello World!!!
from Raphaël
|
|
|
|
|
hi,
can any one tell how i can get the handle of each opened explorer window..& also the usage of get_opener
what i want to do is to block the user from clicking the new window command..if he clicks it i want that new window to close..pls help me..
|
|
|
|
|
Hi all,
I am wondering about using exception handling in ATL *without* the need to dinamically link to msvcrt.dll... can one do it ?
I can't use SEH due to C++ classes.
|
|
|
|
|
Sure, just link statically to the CRT (the MinDependency configs do this already when you remove the _ATL_MIN_CRT preprocessor symbol)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Help !!
The size of my program doubles from 28 K to 56 K !
Is this the price to pay to use exception handling ???
|
|
|
|
|
This is the price to pay for using CRT.
|
|
|
|
|
So every ATL program that uses exception handling needs to link CRT...
Is this the price to pay for using exceptions ?
|
|
|
|
|
Hi,
Im developing a application in ATL..My problem is when I minimize the application,it should disappear from Taskbar and tray icon should be created..
No i dunno how to dissappear it from Task bar..So any idea....or ny links..
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
|
In my application, i use UISetCheck to check buttons in my menu. But i can't get UISetRadio() to work. It doesn't do a thing. I used
UPDATE_ELEMENT(ID_TASKBAR_SIGNIN, UPDUI_MENUPOPUP)
to make WTL handle it but do i need to do something else with it to make it handle radio buttons too?
Thanks
|
|
|
|
|
UIUpdateMenuBarElement() doesn't support radio-checking menu items, although it is possible to add the code to do it. I did it for my own work a few weeks ago, when I get home I'll see if I can find the code (I didn't end up using it after all, so I might not have kept it)
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Well did you ding it ? And if you didn't, i can't mix up API calls with this UIEnable thingy, cause then the API calls don't seem to work...
|
|
|
|
|
|
is there a way to do this:
int sum = 0;
for (myIterator it = sv.begin(); it != sv.end(); it++)
{
sum+=(*it).GetValue();
}
using for_each or accumulate, without writing extra functions? in other words, i want it all on one line...
int sum = std::accumulate(sv.begin(), sv.end(), 0, some_way_to_call_GetValue()_on_the_current_item);
?
(i should really go buy an STL book)
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
|
not exactly without extra functions, but you will need + operator. here's something similar:
class CLong
{
public:
CLong(long l) : m_val(l){;}
const long Val() const {return m_val;}
CLong operator+(const CLong& rhs)
{
return CLong(m_val + rhs.Val());
}
private:
long m_val;
};
using namespace std;
int main(int argc, char* argv[])
{
std::vector<CLong> v;
v.push_back(1L);
v.push_back(4L);
v.push_back(9L);
CLong csum(0);
csum = accumulate( v.begin(), v.end(), csum, mem_fun1_ref(&CLong::operator+));
cout << "sum: " << csum.Val();
return 0;
}
|
|
|
|
|
There is a way to do this by writing a template for the functor. You can do something like:
<br />
#include <iostream><br />
#include <numeric><br />
#include <vector><br />
<br />
using namespace std;<br />
<br />
template<typename SumType, class D><br />
class MemFuncAdder<br />
{<br />
public:<br />
typedef SumType (D::*func) () const;<br />
<br />
MemFuncAdder( func f )<br />
{<br />
m_f = f;<br />
}<br />
<br />
SumType operator() (SumType running_sum, const D& data)<br />
{<br />
return (running_sum + (data.*m_f) () );<br />
}<br />
private:<br />
func m_f;<br />
};<br />
<br />
class Data<br />
{<br />
int value1;<br />
int value2;<br />
public:<br />
Data( int v1, int v2) : value1(v1), value2(v2) {}<br />
<br />
int V1() const { return (value1); }<br />
int V2() const { return (value2); }<br />
<br />
friend ostream& operator<< ( ostream &os, const Data &data)<br />
{<br />
os << "( " << data.value1 << ", " << data.value2 << ")";<br />
return os;<br />
}<br />
};<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
vector<Data> array;<br />
<br />
array.push_back( Data( 1,1) );<br />
array.push_back( Data( 1,2) );<br />
array.push_back( Data( 1,3) );<br />
array.push_back( Data( 1,4) );<br />
array.push_back( Data( 1,5) );<br />
<br />
copy( array.begin(), array.end(), ostream_iterator<Data>( cout, ", " ));<br />
cout << endl;<br />
<br />
cout << "Result 1 = " << accumulate( array.begin(), array.end(), 0, MemFuncAdder<int,Data>(&Data::V1) ) << endl;<br />
cout << "Result 2 = " << accumulate( array.begin(), array.end(), 0, MemFuncAdder<int,Data>(&Data::V2) ) << endl;<br />
<br />
return 0;<br />
}<br />
Once you provide the MemFuncAdder template, you can call accumulate on multiple member functions without needing to write additional code. If you need a different operation other than addition, you could provide other templated functor classes.
|
|
|
|
|
has anyone ever seen a wrapper for a list control or tree control that can act as an STL container?
i'm dealing with a CListCtrl right now, and i noticed that it would be great to be able to do something like:
foreach(m_listCtrl.begin(), m_listCtrl.end(), do_something_with_selected_items);
or, to load items:
m_listCtrl.insert(lvitem);
m_listCtrl.push_back(lvitem);
you could treat a list control as a vector. and you could treat a CTreeCtrl as a tree (duh) of some kind. maybe you could sort the list control with std::sort, etc..
i don't need this functionality, i just thought it would be a really slick bit of code.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
It would be a nice contribution (volunteers? ). Anyway, I think this should be modelled after std::list rather than std::vector .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
if i knew anything about the internals of an STL container, i would've written it myself before giving away the idea. maybe i'll take a look at your map for inspiration
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Chris Losinger wrote:
has anyone ever seen a wrapper for a list control or tree control that can act as an STL container?
How about this:
WINSTL[^].
-Nick Parker
|
|
|
|
|