codingate
u/codingate
Sample scenario: Pop OS has custom output in lsb_release compared to Ubuntu (which is totally fine, that's expected).
Is there an official docker image for Pop OS? Either a full or stripped down image would be ok as far as the installation sequence (via apt or flatpak) results in the same binaries being installed.
High core count and RAM is preferred. GPU is cherry on top. Battery life of less than 5 hours is bad, and more than 8 hours (for normal workload) is awesome. Having a decent IO (ethernet, 2-3 USB, 1 SD card, HDMI) are nice perks, worth about a 100$ for the expensive "official" dongle needed to add those.
Main use: typical office workload and lots of reading, typing (touch preferred for annotating) and some compilation thrown in along with (not concurrently) some light gaming and movie watching on the weekends
My shortlist:
| Laptop | Type | RAM (GB) | Core | Graphics | Storage (GB) | Screen |
|---|---|---|---|---|---|---|
| Lenovo P52 | stock | 16 | i7 8750H | Quadro P1 |
There's this old C API that could use a saner, safer wrapper around it. The API allocates a block of memory by itself and returns the pointer to it (the float* mentioned in the title) and the size. It also takes in float* const and size (though it never reallocates, thankfully)
The usage was quite similar to std::vector and indeed the first thing we did was copying the memory into a vector, freeing the original memory and returning the vector. The option to use std::unique_ptr wasn't considered since we don't get dynamic resizing among other niceties from std::vector.
Is there a way to use the original block of memory and hand it to a vector like class (not necessarily `std::ve
Bill the bar for the Bill to bar Bill Barr from the Bar
First post with too many f and t for my liking
I know, C++20 isn't out yet and coroutines are not meant for normal developers.
But I was using a library that I think would do quite well if it used ranges (and ranges are one of the things that is recommended to be implemented using coroutines) and coroutines (for lazy processing). Before proposing this idea, I wanted to get a few things clarified (for myself and for future discussions)
- is it sufficient for an object to define
begin()andend()to enable use of ranges on it? (Object has contiguous memory associated with begin and end) - is there a way to pass a coroutine (share it) from one function to another and continue the call (I saw it being alluded to in several posts)? *
This issue has been nagging me for a long time. Assuming I'm solely interested in getting switches to work for strings (std::string), would it make sense to the people here to propose something more general aka custom data types in switches or would std::string would be sufficient? I'm asking because using std::map or hashing every item in the case statement doesn't make sense to me. Moreover, this is a "basic" enough task that would help almost every C++ dev and I'm pretty sure a lot of shops have something that emulates this functionality internally.
Currently, even with all C++ features that I can think of, the following is the best I can do to get a switch case on custom datatype
I wanted to compare (and benchmark) exclusive_scan, inclusive_scan and partial_sum. So I decided to try out the default sample on cppreference.com
It refused to compile. Same results with cpp.sh and godbolt.org
Any ideas why? I'm using C++17 flags with the latest compilers.
Code
#include <functional>
#include <iostream>
#include <iterator>
#include <numeric>
#include <vector>
int main()
{
std::vector data {3, 1, 4, 1, 5, 9, 2, 6};
std::cout << "exclusive sum: ";
std::exclusive_scan(data.begin(), data.e
I had a simple function template:
template <class To, class From>
To convert(const From& value, Helper data = {});
And all was good. Until, there was dire need for it to be specialized for some pairs of data-types. So I went ahead and did exactly that:
template <>
To1 convert(const From1& value, Helper data) { ... }
template <>
To2 convert(const From2& value, Helper data) { ... }
It worked! However, the joy was short lived. As it turned out, Helper was actually a class template with some predef value. And there's a conversion between it's variants. For simplicity, assume the relation is something like
template <enum Protected
Blockada is an awesome app. But there can be a lot of reasons for not using its VPN (such as pre-existing subsription, work provided, personal setup, etc.)
Is there a way we can choose the VPN app used to activate the VPN instead? This would allow me to use Blockada as my privacy center
I know that there is a way to achieve the following code where the compiler chooses the best fit function for the arguments using overloaded lambdas
auto foo_wrapper = FunctionWrapper([](int a) { return a+1;},
[](double b) { return b/2; });
assert(foo_wrapper(3.0) - foo_wrapper(0) == 0.5);
The links to read more about this trick are at the bottom of this question
However, is there a trick to let the compiler choose the class of an object from a list of classes based on the functions called?
class Foo { v(int); };
class Bar { p(int); v(int); };
auto foobar_wrapper = ClassWrapper(Foo, Bar);
// some syntax trick here to achieve the equivalent of the followin
So I'm refactoring an old class which essentially runs some functions in a pipeline and for the premise of the question, this particular class accepts functors as parameters in the constructors.
I have the following 3 options, ranked in order of how I like them:
- Use a trait class instead to squirrel types away and to consolidate all the different types in one place. Requires a using declaration inside the class to be really useful, and it could use some MACRO to clean it up and look real nice.
- If I put the
std::functionin the place, it makes the code look ugly. I don't think it is acceptable, but it's scalable. - If I use global
usingdirectives, it pollutes the namespace with
Clicking on downvote actually upvotes, but this only happens sometimes
Observed it more in certain subreddits but that might be because I downvote more on them
I was reading a paper on arxiv which was related to how we can identify (highlight) the features which result in a particular image-classification output by back-propagating saturation values from the final softmax layer to the first layer. I can't seem to find the paper despite trying a number of PnC on search terms.
I knew the paper had images of a cat, fire hydrants (in 3 colors) and was not a recent paper.
I've looked at a number of papers which create heatmaps and find relevant pixels using occlusion and related feed-forward techniques. Those are not the papers I'm looking for.
Also, I'm not sure where to post such a request. It's not a beginner request. r/mlpapers seems to be dead