• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






中華大帝

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  c++

1

C++ 是个神奇的语言……太神奇了,为什么不进化成 D++ 呢?
 
C++11 unistring 类(编码转换)
摘要:C++11 的编码转换程序: #ifndef UNISTRING_HPP #define UNISTRING_HPP #include <algorithm> #include <codecvt> #include <cstdio> #include <cstdarg> #include <iost 阅读全文
posted @ 2022-10-30 00:36 中華大帝 阅读(131) 评论(0) 推荐(0)
c++ delegate 类,最大16个参数,用程序生成的代码
摘要:2017-02-16 04:58:34 发布于 CSDN 现转博客园。 读这篇文章的前提是,我们使用的编辑器对c++11的支持不太友好。下面是测试代码: #include <stdio.h> #include <stdlib.h> #include "delegate.h" using namesp 阅读全文
posted @ 2022-08-28 11:17 中華大帝 阅读(36) 评论(0) 推荐(0)
c++一维数组指针转二维数组指针
摘要:typedef float mat4[4][4]; void mat4_set(mat4 m) { for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { m[y][x] = y * 4 + x; } } } template<type 阅读全文
posted @ 2022-06-19 13:05 中華大帝 阅读(178) 评论(0) 推荐(0)
pool_allocator 轻量模板内存池
摘要:只能一次申请一个对象,没有线程锁。 template <typename T, size_t PAGE> class pool_allocator { public: typedef pool_allocator this_type; typedef T value_type; typedef va 阅读全文
posted @ 2022-05-19 12:00 中華大帝 阅读(59) 评论(0) 推荐(0)
根据文件数据,检测文件类型
摘要:这个函数,我会一直扩充下去。很多资料是网上查的,有自己分析的,当然肯定有bug。 目前头疼的是mp3格式的检测,有的mp3文件前面有一些空白,而且长度不固定。 iso 的鉴定方式貌似不对,我电脑上的几个iso貌似那个 “CD001” 的tag不在那几个地址。 mp4 理论上能检测常见的一些内部格式, 阅读全文
posted @ 2022-05-19 11:56 中華大帝 阅读(182) 评论(0) 推荐(0)
动态二维数组
摘要:/* array2d.hpp sdragon 2006-10-08 22:26:44 创建二维数组的程序。array2d<T>::array_t 是 C 的纯指针模式,一定要使用 delete_array2d<T>()删除。 由 vector<T> 创建的数组的效率要高一些 */ #ifndef C 阅读全文
posted @ 2022-05-19 11:50 中華大帝 阅读(27) 评论(0) 推荐(0)
文件名匹配算法(windows下的[*?])
摘要:/* fn_compare.hpp sdragonx 2015-02-25 14:32:54 */ #ifndef FN_COMPARE_HPP_20150225143254 #define FN_COMPARE_HPP_20150225143254 #include <string> #defin 阅读全文
posted @ 2022-05-19 11:49 中華大帝 阅读(131) 评论(0) 推荐(0)
任意数据长度的 bitset,以及按位读写数据的函数
摘要:如果没有定义过 byte_t 类型: #include <stdint.h>typedef uint8_t byte_t;//typedef unsigned char byte_t; // 1 个 byte 字节,8位,一般系统中能表示的最小字节数据。 // 位写入函数 uint32_t bit_ 阅读全文
posted @ 2022-05-19 11:47 中華大帝 阅读(103) 评论(0) 推荐(0)
c++ 字符串分割函数 stringsplit
摘要:新版: /* stringsplit.hpp sdragonx 2006-06-16 00:43:16 revise 2018/7/28 19:42 function list: size_t stringsplit(container, const char_type*, size_t, char 阅读全文
posted @ 2022-05-19 11:07 中華大帝 阅读(180) 评论(0) 推荐(0)
glfw C++ 封装简单例子
摘要:直接上代码,glfw_window.hpp: #ifndef GLFW_WINDOW_HPP #define GLFW_WINDOW_HPP #include <cstdlib> // onexit() #pragma execution_character_set("utf-8") // utf8 阅读全文
posted @ 2022-04-11 13:48 中華大帝 阅读(399) 评论(0) 推荐(0)
c/c++ 一维数组指针转二维数组指针
摘要:有时候会遇到这样的函数: void func(float m[3][3]) { } 而你手头上有个数据: float data[9]; 直接用函数调用,会提示类型转换错误,那么怎么传进去? 传统方法1,生成一个二维数组指针: float* p[3] = ( data, data + 3, data 阅读全文
posted @ 2022-02-08 23:59 中華大帝 阅读(1209) 评论(0) 推荐(0)
glm C++ 98 版本
摘要:glm C++ 98 版本 https://github.com/sdragonx/glm glm 原库作为图形基础库,下载使用量没有 cglm 多,其中一个原因就是,这个库竟然用 C++ 11。这里是一个 C++ 98 版本的 glm 库,兼容比较老的编译器。虽然有些方法在实现上,C++ 11 比 阅读全文
posted @ 2021-11-20 03:45 中華大帝 阅读(212) 评论(0) 推荐(1)
minivg - 初学者的图形库
摘要:minivg 今天正式发布一个初学者用的程序库——minivg。这个库结构简洁,使用方便,容易理解。包含基础的绘图函数,键盘鼠标控制,音乐、声音播放,是写小作品的不二选择。 值得一提的是,这个库封装了GDI+绘图接口,GDI+是Windows Vista之后的系统内置的绘图API(xp也能使用),比 阅读全文
posted @ 2020-06-23 22:24 中華大帝 阅读(313) 评论(0) 推荐(0)
32 位程序 new 不出 1G 内存的原因
摘要:有个程序,需要处理一张16384x16384大小的图片,需要把整个图片读入内存,常规处理了半天总是内存报错,起初怀疑GDI的问题,后来发现是内存申请问题。很奇怪,32位程序也应该有2G的用户内存啊,怎么new不出来1G内存? 无聊,写了个测试内存申请程序如下: int M = 1024*1024; 阅读全文
posted @ 2020-05-19 23:04 中華大帝 阅读(339) 评论(0) 推荐(0)
c++ 一些代码测试
摘要://多继承与虚函数 struct CA { virtual int func() { return 1; } int a() { return func(); } }; struct CB { virtual int func() { return 2; } int b() { return fun 阅读全文
posted @ 2020-02-14 16:19 中華大帝 阅读(201) 评论(0) 推荐(0)
C++Builder下载地址
摘要:C++Builder Compiler http://altd.embarcadero.com/download/bcppbuilder/BCC102.zip C++Builder EX 10.3.3 http://altd.embarcadero.com/download/radstudio/10 阅读全文
posted @ 2020-01-25 15:52 中華大帝 阅读(2047) 评论(0) 推荐(0)
OpenGL 字体绘制
摘要:/* glfont.hpp sdragonx 2019-08-15 00:03:33 opengl字体类,提供初学者参考学习 opengl初始化之后,创建字体 font.init(L"微软雅黑", 32, 512); 然后在绘制函数里面添加以下测试代码: //开启2D模式,后面的800x600要根据 阅读全文
posted @ 2019-08-15 14:34 中華大帝 阅读(1097) 评论(0) 推荐(0)
c++编程中处理char和wchar_t的好工具
摘要:/* ttype.h sdragonx 2015-02-18 18:32:43 这个几个模版函数是为了处理ansi或unicode,使字符串值或者字符串函数能够在模版中使用 2018/7/26 23:20 ttype::type //type is char ttype::type //type is wchar_t char* str = tvalue("an... 阅读全文
posted @ 2019-06-08 07:02 中華大帝 阅读(290) 评论(0) 推荐(0)
float(double)快速转换int的方法
摘要:float(double)快速转换int的方法总结 阅读全文
posted @ 2019-05-27 20:47 中華大帝 阅读(13133) 评论(0) 推荐(1)
android_app c++框架
摘要:android_app c++ 框架 阅读全文
posted @ 2018-11-25 02:55 中華大帝 阅读(1298) 评论(2) 推荐(0)
 

1