所以我有这三个文件
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include "support.h"
int main( void ) {
int* num1 = malloc(100);
printf("num1: %p", &num1);
}
Run Code Online (Sandbox Code Playgroud)
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "support.h"
void *malloc(size_t size) {
struct block_meta *block;
if (size <= 0) {
return NULL;
}
if (!global_base) { // First call.
block = request_space(NULL, size);
if (!block) {
return NULL;
}
global_base = block;
} else {
struct block_meta *last = global_base; …Run Code Online (Sandbox Code Playgroud) 如果我的List<String[]>每个人String[]都如下所示:{FirstName,LastName,Income,City}我将如何使用Java 8 lambda通过特定值(例如收入或名字)对列表进行排序?
这是我的main方法的代码,应该很明显我试图让迭代器按名称访问元素
#include <iostream>
#include <list>
#include "PC.h"
#include "SunServer.h"
using namespace std;
int main(){
PC mypc1("John", "645.22.55.34", 128, "admin");
PC mypc2("Mike", "645.22.55.34", 128, "admin");
PC mypc3("Rick", "645.22.55.34", 128, "admin");
PC mypc4("Bill", "645.22.55.34", 128, "admin");
list<PC> my_group;
my_group.push_front(mypc1);
my_group.push_front(mypc2);
my_group.push_front(mypc3);
my_group.push_front(mypc4);
list<PC>::iterator curr = my_group.begin();
while (curr != mypc2){
// do something
}
}
Run Code Online (Sandbox Code Playgroud)
现在很明显它不起作用,但有什么我可以做的,这相当于这个?谢谢