Anonymous
Btw it's inefficient because we're calling copy constructor? And what can be the efficient way then
You could just store the next value to be returned as a state within your object and return it for subsequent peek calls. Update this state when next is called.
Leovan
Hello. In std::regex_replace "$&" is a copy of the entire match, what if I need a little change finded word, for example: I need replace _hello_ with *ello*
LeBouy
write the code that takes a vector of numbers as input. It separates the input vector elements into three sets: even number, odd numbers and prime numbers. It returns the three output arrays as [prime even odd]. The program should perform the following functionality: (ii) Sort the array into prime, even and odd sets. (iii) Return the prime, even and odd sets. (iv) The function must test that there are sufficient input arguments. (v) The function must print an error message if there are less than required input arguments. (vi) The program must print the following: The prime set is: The even set is: The odd set is
Leovan
are capture groups not enough?
Yes, i solved it by them. Anyway thank you
♾️
Bye c rust is now my new best friend
Roxifλsz 🇱🇹
Anshul
The calling code could be like vec<int> tmp; PeekingIterator it(tmp); tmp.push_back(.......);
i have a issue, vec<int> tmp; PeekingIterator it(tmp); // now here you'll first make all calls to hasnext, next, peek and after all calls are done you'll change tmp right? because in the question it is //said don't create a new nums integer. just use the existing one. (and even in the iterator class the next and hasnext function will be written //thinking that the nums vector won't change) // all the modifications to tmp vector or nums will be made here, when all calls are done all this is like this following code where we're changing the vector but after the operations are performed using iterator, which should run fine without any ub #include<iostream> #include<vector> using namespace std; int main() { vector<int> v; v.push_back(0); v.push_back(1); v.push_back(2); v.push_back(3); int *it=&v[0]; int t=4; while(t--) { cout<<*it<<endl; it++; } v.push_back(4); v.push_back(5); }
Anshul
Ludovic 'Archivist'
Why is that?
Oh I forgot another point, 100% support of C++20
Anonymous
Probably Microsoft Visual C++ Compiler
I find hard setting it up, regardless how many times I try. I am not able to do the set up. :/
Danya🔥
Oh I forgot another point, 100% support of C++20
I don't consider this as a significant advantage since it's not production ready anyway
Ludovic 'Archivist'
I find hard setting it up, regardless how many times I try. I am not able to do the set up. :/
Don't worry, half of the AAA game dev companies fuck that up too
Ludovic 'Archivist'
Ludovic 'Archivist'
Is the VS Installer so hard to use?
The dozens of menus of options are
Dima
imagine using vs for professional work
Danya🔥
The dozens of menus of options are
To install the compiler you need to press 4 buttons and check one checkbox
Danya🔥
imagine using vs for professional work
VS22 is actually quite good
Anonymous
Is the VS Installer so hard to use?
I don't have a computer background I find it hard using it as a compiler, I don't find any issues using it as an Arduino ide or for GitHub.
Anonymous
Don't worry, half of the AAA game dev companies fuck that up too
To be honest I don't understand what that means
Danya🔥
And should not use it as a compiler for Arduino
Ludovic 'Archivist'
imagine using vs for professional work
That is what around 44% of people use apparently
Danya🔥
Ohh why not?
Because it doesn't support this functionality, probably? :)
Anonymous
And should not use it as a compiler for Arduino
Arduino lacks several libs, while you can access them using an extension named platform io in vs code
Ludovic 'Archivist'
I mean to use it
Look at companies forgetting to build their software with fallback for AVX instructions for example
Anonymous
VS != VS Code
Oh yeah I misinterpreted it
me
Hello friends, me again, i need a pseudo code the check if binary tree is complete or not, and return true if is
Danya🔥
Look at companies forgetting to build their software with fallback for AVX instructions for example
Is there any support from compilers/build systems to automatically generate several versions of one code and to add the fallback code?
Anonymous
VS != VS Code
so far the tutorial I saw had both vs and vs code for compiling c++? you can compile and run code without vscode?
Anonymous
i'm not much intelligible about these ide's and compliers, but i only use vscode and few extensions to run arduino codes which is in c++
Anonymous
so now i am confused, if that's a text editor how's that even happen to work
klimi
(addons)
Anonymous
yes those extensions, doesn't that work the same for C++ compiler a gnu addon probably?
J
no, i am confused completely now
Compilers compile code(ie, convert piece of text into executable exe or binary).eg: MSVC, Clang, gcc, tcc, etc... You write code using special envs like IDE or using Text Editors like VSCode or even notepads. Why VSCode? IDE's(Visual Studio, Clion, Eclipse, Geany, etc...) work with only specific languages. But with a text editor like VSCode, with extensions, you can write for multiple languages. Also, vim, neovim, Sublime text, notepad++ exist Why clang or MSVC won't compile your Arduino code? It's because iirc, Arduino uses its own style of C++
klimi
Anonymous
i tried and followed installation multiple times i am missing something
Anonymous
afaik (i don't use them) they just execute the compiler
okay probably i should use someother IDE?
J
ah right if i wish to use vs for compiling C++ what should I be doing
Since you want to code for Arduino, install their extension and press ctrl + shift + p. It will provide options to create a new Arduino project and compile and execute code for your Arduino module.
Anonymous
i already use it for arduino
klimi
okay probably i should use someother IDE?
whatever you want, it is up to your preference
Anonymous
whatever you want, it is up to your preference
man, consider I have zero experience with these ide's so far what I used are just online compilers dumb me
J
i want to use it for C++
Which is your favorite compiler? MSVC(Windows only) or clang(Cross platform and my fav since I use linux) or gcc?
Anonymous
anything if that works
J
i used windows
You need to install C++ tools using Visual Studio installer.
klimi
anything if that works
clion is solid option
Anonymous
You need to install C++ tools using Visual Studio installer.
yes but the issue is i can't set it up actually
Anonymous
Anonymous
if you don't want to explore various programs, just use notepad
i do want to explore, but i haven't used any program yet
Anonymous
how can I think about exploring already
J
yes but the issue is i can't set it up actually
If you installed it, search for C/C++ extensions and install it
J
In VSCode
Anshul
Please do not do int* it. Use auto it = std::begin(v);
Then I'll be using already existing iterator
klimi
i do want to explore, but i haven't used any program yet
options are really unlimited, to list a few: visual studio, atom, visual studio code, vim, emacs, micro, notepad, notepad++, codeblocks, codelite, kdevelop, kate, geany, clion, nano...
Anonymous
i am able to get response for clang versions in vs code command prompt
Anonymous
but i can't actually run and compile
J
but i can't actually run and compile
Let's use MSVC first. ctrl + shift + p and search for something that states cl.exe build active file
klimi
if you don't want to bother setting up your environment... just use some integrated development environment
Anonymous
Let's use MSVC first. ctrl + shift + p and search for something that states cl.exe build active file
out of frustation i had already removed vs lemme install it once again and ping you once I am done doing it
Anonymous
i'll try to set such environment meanwhile