本文分类:news发布日期:2025/5/8 18:57:13
相关文章
Golang 方法的接收器 receiver 指针和值的区别
一、如果receiver是指针类型
package mainimport "fmt"type Count struct {count int
}func main() {c : Count{count: 0}c.incr()fmt.Println(c.count)c2 : &cc2.incr()fmt.Println(c2.count)
}func (c *Count) incr() {c.count
}//打印结果 1 2
incr 方法的 …
建站知识
2025/5/3 15:41:36
python实现卡普均值最小回路算法
如果给定一个含有环的有向图,要在这个图中找出所有的环并计算这些环的路径长度,然后除以环的边数,所得到的结果也就是环的平均值,这里也就是如何计算这个环的最小均值问题。
首先可以确定的是,如果图中均值最小的环的值是0,那么图中就不包含负环,由于是负环,那么所有边…
建站知识
2025/5/8 18:40:46
TypeScript编译选项
编译单个文件:终端 tsc 文件名
自动编译单个文件:终端 tsc 文件名 -w
编译整个项目:tsc 前提是得有ts的配置文件tsconfig.json
自动编译整个项目:tsc --w
tsconfig.json默认文件内容: tsconfig.json是ts编译器的配…
建站知识
2025/5/1 10:57:43
PyTorch搭建LeNet训练集详细实现
一、下载训练集
导包
import torch
import torchvision
import torch.nn as nn
from model import LeNet
import torch.optim as optim
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as npToTensor()函数:
把图像…
建站知识
2025/3/3 16:05:03
Android 使用AIDL HAL
生成的目录结构
以audioControl 为例: 首先编写的是aidl文件。 其文件目录结构是:── android
│ └── hardware
│ └── automotive
│ └── audiocontrol
│ ├── AudioFocusChange.aidl
│ ├── AudioGainConf…
建站知识
2025/5/5 6:08:42
【力扣hot100】刷题笔记Day25
前言
这几天搞工作处理数据真是类似我也,还被老板打电话push压力有点大的,还好搞的差不多了,明天再汇报,赶紧偷闲再刷几道题(可恶,被打破连更记录了)这几天刷的是动态规划,由于很成…
建站知识
2025/3/15 9:52:27
09 string的实现
注意
实现仿cplus官网的的string类,对部分主要功能实现
实现
头文件
#pragma once
#include <iostream>
#include <assert.h>
#include <string>namespace mystring
{class string{friend std::ostream& operator<<(std::ostream&a…
建站知识
2025/5/3 4:22:07