Well, depends on the algorithm, I guess. I can see sort() messing up the string. I can see a reverse algorithm also messing up the string. Good point. Didn't think of that. I've rarely run algorithms...
Type: Posts; User: Elysia
Well, depends on the algorithm, I guess. I can see sort() messing up the string. I can see a reverse algorithm also messing up the string. Good point. Didn't think of that. I've rarely run algorithms...
Best way is to keep all your files in UTF8. Keep all your strings internally as UTF16. This is probably a bit tricky since there is no native way to do this. This depends on your compiler, if it can...
They may or may not. It depends on your character set. If it's UTF8 or ANSI, there shouldn't be any problems. But if you're using UTF16 or something else, you may get problems with \r and \n...
The problem is most likely going to mount down to whether or not your system supports UTF8 or not in its interfaces taking char* parameters. Linux does. Windows does not.
There are wide versions,...
What you need to write in C++ is:
std::string asterisk;
printf("fooRef: %d\n", fooRef);
printf("foo: %d\n", foo);
This is just undefined behavior. Don't use printf in C++.
This doesn't tell you anything.
This example might be interesting:
...
No, a reference is not a memory address. It's a type that may contain data and functions. Hence it does make sense to treat it as an "int".
If you're just trying to understand references, then...
*this is not 1000. this is a pointer to the class itself, hence *this is the class itself. The class is not an integer, hence that is not valid.
The clang source uses CMake to build it.
Last I tried to open clang (CMake) with VS 2017 RC, it didn't work. So there's that.
>>std::cout << ">> ", std::cin >> n;
That's equivalent to:
std::cout << ">> ";
std::cin >> n;
That was not the point. The point was that, you can't expect or demand that legacy software runs on modern operating systems, because chances are, it won't. You should upgrade your software. How much...
Modern operating systems do not support legacy software. We've been through this. If you want to run VC6, go ahead and run an older Windows in a virtual machine.
Additionally there's GCC (MinGW for Windows) and Clang (though that's a pain to get working for Windows).
#include <vector>
#include <string>
constexpr int size = 2; // Use constexpr for constant data, if possible; otherwise const.
std::vector<std::string> array{ makeArray(size) }; // Use...
Before posting, copy & paste the code you're going to post into a source file and compile.
Does it fail to compile? Don't post it.
Does it work as it should? Don't post it.
Does it compile and...
Use a vector:
std::vector<char> Buf(1024);
// Write to buffer
// Null terminate buffer if boost doesn't
// Now let's add the buffer to the string
MyStr += &Buf[0];
It would be easier if you...
Yeah, I've tested it - and used it for a while now, mostly for C#. It fixes the annoying issue where the IDE hangs when terminating a debug session in C#. And obviously it implements more C++ stuff -...
Just disable optimizations:
invoking default constructor
invoking move constructor
Always!!!
>> moveable m;
>> m = get_moveable();
Change that to
auto m = get_moveable();
and enable optimizations. The former might work if the compiler is smart enough.
Also, remove "void" from...
It depends a little on your requirements too. The above mentioned laptop has poor resolution, no SSD and a watered-down processor.
Personally, I'd go for something like Acer 15.6" V5-591G-55PV Intel...
It's not related to RVO. If you have a local variable that is returned and meets a certain set of requirements, it's implicitly moved when you return it. If RVO kicks in, then the variable won't even...
It is true that shared_ptr can subsume all other pointers (except weak_ptr for certain situations). However, shared_ptr has more overhead than unique_ptr and scoped_ptr (which is actually not a smart...
Ugh. C# can be pretty confusing too because it doesn't make a distinction between a pointer and a reference. It's motto seems to be just pass the damn object and it will work. Except, sometimes it...
This whole weird and stupid behaviour is due to C++'s C legacy. Basically, the C standard says it shall work as you see it works. C++ fixed the problem with reference types, so passing an array by...