> Show me a clever hack for using deque instead of vector in C++<p>Ans:<p><pre><code> // This function will reverse the order of a vector.
void reverse(std::vector<int>& vec) {
std::deque<int> deq;
for (int i = 0; i < vec.size(); i++) {
deq.push_back(vec[i]);
}
for (int i = 0; i < vec.size(); i++) {
vec[i] = deq.front();
deq.pop_front();
}
}
This is a clever hack because it avoids the need to write a custom function for reversing the order of a vector.
</code></pre>
But it <i>did</i> write a custom function?!
Interesting, I asked it this:<p>> Me: Write a golang function to get a http request, following the API of the get function in Python requests library.<p>> Bard: Sure, here is a Golang function to get an HTTP request with an API similar to the requests.get() function in Python:<p>It produced a function that takes url and parameters. Decent first approximation.<p>ChatGPT has trouble with this (when I tried a couple months back)
Why on earth is there no link to whatever this "bard" actually is on that page - I need an on-ramp/slip road?<p>There is a link to "Learn More" which is also ... eventually a link wonders off somewhere ... nope some wankery about Lamda thingie. [random futile clicking]<p>It's the basics kids. No matter how far up your arse you are about your funky technology, do enable people to find the bloody thing easily, from all related pages. If you are a little rusty on spelunking then have a look at WAIS and Gopher (int al) for how to do it properly.<p>Obviously I can find it because I'm a fucking IT consultant. Why not make it easy for everyone?
I know we all love GPT-4, and it totally deserves it, but we really need to support other companies building their own large language models even if it's Google. We don't want a monopoly situation.