Can someone explain what is going on in the below code snippet line by line
auto enq_func = [](std::queue<reg_t>* q, uint64_t x) { q->push(x); };
std::queue<reg_t> fromhost_queue;
std::function<void(reg_t)> fromhost_callback =
std::bind(enq_func, &fromhost_queue, std::placeholders::_1);
I think I get the gist of it, that fromhost_queue is a std::queue of each element of type reg_t which was typedef in the beginning of the code as uint64_t and its enqueue functionality is defined using the above three lines something like that.
I have trouble understanding line 1 as I haven't come across this type of function declaration like =[](...){...};
is this some sort of shorthand or something
Also, in the bind() part in line 3, the first argument is a function(here named as enq_func) that bind will be applied on the second argument mostly used to pass a reference of a queue the enq_func will be applied but the last is an argument which will we enqueued but I don't see the enq_func having any arguement
can someone clarify this?