Skip to content

Instantly share code, notes, and snippets.

func GroupBy(data any) map[string][]ObjForGroupBy {
datas := reflect.ValueOf(data)
var result = make(map[string][]ObjForGroupBy)
l := datas.Len()
for i := 0; i < l; i++ {
obj := datas.Index(i).Interface().(ObjForGroupBy)
strV := obj.GetValueForGroupBy()
result[strV] = append(result[strV], obj)
}
return result
#include <stdio.h>
#include <string>
#pragma warning(disable : 4996)
int main() {
FILE* stream;
std::string file_name = "c:\\abc\\uyhb.jpg";
if ((stream = fopen(file_name.c_str(), "r")) == NULL) {
printf("failed\n");