腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
1
回答
C++
中
的
` `
using
my_type
=
unsigned
;`
vs
` `
using
my_type
=
unsigned
int
;`
unsigned
、
unsigned-integer
在
C++
中
,以下两个代码片段是否等效?
using
my_type
=
unsigned
;
my_type
variable; 如果是这样,为什么还要费心定义
my_type
而不是使用
unsigned
甚至
unsigned
<em
浏览 25
提问于2021-11-19
得票数 0
回答已采纳
2
回答
打印多个不同类型
的
数字限制
c++
、
templates
、
typedef
在下面的代码
中
,我定义了一个名为
unsigned
int
的
my_type
,用于打印类型本身
的
最大值:#include <limits>... typedef
unsigned
int
my_type
; con
浏览 5
提问于2016-02-29
得票数 1
回答已采纳
2
回答
使用模板
中
第一个类型
的
类成员
的
类型
c++
、
templates
、
decltype
搜索我找到
的
站点,以便在类
中
获取成员
的
类型。在此基础上,我创建了下面的示例,该示例成功地编译。#include <iostream>#include <string> public:}; public:
unsigned
int
浏览 0
提问于2020-03-24
得票数 1
回答已采纳
1
回答
boost序列化-在不同命名空间中为单个数据类型使用加载和保存方法
c++
、
serialization
、
boost
、
boost-serialization
对于struct,
my_type
序列化方法是实现
的
,但是如何将my_time和data_type序列化为in,因为它们位于不同
的
命名空间中。
int
version) ar & a; }
my_type
();
unsigned
int
my_time;} }
浏览 0
提问于2014-04-04
得票数 0
回答已采纳
2
回答
STM32F105,arm-none-eabi-gcc,Contiki:在结构
中
存储浮点数,用C语言打印浮点数失败。
struct
、
malloc
、
cortex-m3
、
stm32
、
contiki
; UInt8 type; void* value;接下来我要尝试
的
是为
my_type
结构分配内存,为从创建
的
my_type
对象指向
的
tlv_t结构分配内存,并为从tlv_t对象指向
的
浮点数分配内存。奇怪
的
是,只有在使用浮点数时才会出现这种情况。其他数据类型(如
int
)没有任何问题。不幸
的
是,我真的需要使用float
浏览 3
提问于2014-01-24
得票数 1
1
回答
如何在
C++
中正确使用“使用”关键字
c++
、
using
我需要知道可以在
C++
中使用“使用”关键字
的
作用域。#include <iostream>{ { } MyStruct;
using
my_type
= space_A::
浏览 2
提问于2020-08-21
得票数 0
回答已采纳
1
回答
可以在
C++
中
获取类型别名
的
名称吗?
c++
、
templates
、
metaprogramming
、
template-meta-programming
在
C++
中
,可以获得类型别名
的
名称吗?例如:std::cout << get_type_name<
my_type
>() << std::endl; 将打印
my_type
,
浏览 3
提问于2018-01-14
得票数 3
回答已采纳
1
回答
模板typedefs
的
新"
using
“语法解决了什么问题?
c++
、
templates
、
c++11
、
typedef
、
template-aliases
在C++11
中
,您可以通过执行以下操作来创建“类型别名
using
stringpair = std::pair<std::string, T>;template <typename T>因此,这就提出了一个问题--为什么他们需要提出一个新
的
语法什么东西不能与旧
的
浏览 30
提问于2013-10-18
得票数 16
回答已采纳
1
回答
使用基类声明
的
c++
模板
c++
、
templates
、
c++11
为什么下面的代码不能工作(使用
VS
2013)?class Test1public:
using
my_type
= T;class My : public Tpublic:
using
my_type2 = t_type::
my_type
<V>;
int</
浏览 0
提问于2015-04-20
得票数 1
回答已采纳
4
回答
污染全局命名空间
c++
、
namespaces
、
typedef
我想这里
的
大多数
C++
程序员都会同意污染全局名称空间不是一个好主意,但是有时候这个规则是可以忽略
的
吗?例如,我有一个需要在特定应用程序中使用
的
类型--我应该这样定义它:或者使用名称空间:mytypes.h typedef
int
MY_TYPE
; ns::
浏览 1
提问于2008-11-06
得票数 2
回答已采纳
3
回答
存取类型成员
c++
、
c++11
、
template-meta-programming
、
typetraits
在我
的
例子
中
,我有一个类Foo<T>。在我
的
函数test
中
,我需要获得Foo
的
模板参数,否则就是普通类型。首先,我开始使用std::conditional,但忘记了模板参数必须都是有效
的
,无论选择哪个参数。是为non-Foo类型创建类型专门化
的
唯一方法吗?#include <type_traits> class Foopublic:
using
M = T
浏览 0
提问于2015-10-13
得票数 2
回答已采纳
1
回答
使用boost mpl lambda和可变模板类
c++
、
boost
、
template-meta-programming
、
variadic
、
boost-mpl
我很难理解为什么下面这个简单
的
程序不能编译。我有一个可变模板类(下面是
my_type
),我想使用它来转换mpl向量。T> // expectedresult is vector<
my_type
<
int
>,
my_t
浏览 1
提问于2016-12-07
得票数 2
回答已采纳
1
回答
列表
中
的
std::is_constructible
c++
、
c++14
我想从我可以用模板参数构造
的
列表中找到类型。在本例
中
:
my_type
必须是std::string,因为在列表
中
,std::string是可以用char *构造
的
第一个。>::type}; {
浏览 1
提问于2016-11-04
得票数 1
回答已采纳
2
回答
根据编译时传递
的
模板值参数(
c++
),是否有正确
的
别名类型?
c++
、
c++17
根据传递
的
模板参数,我想要别名类型。根据传递
的
模板参数
int
值,返回类型将被确定。但我想要
的
东西有很多种。我想用干净
的
密码做这件事。我需要从
int
值
中
混叠出许多类型。template <
int
value> std::conditional_t<value== 1, Type1, std::conditional_t<value== 2, Type2, std::conditional_t实际上,如果我将类型放在返回类型
浏览 1
提问于2021-01-09
得票数 1
回答已采纳
1
回答
基于静态条件
的
非嵌套类型
的
延迟引用而没有编译错误?
c++
、
templates
、
typedef
、
template-meta-programming
、
conditional-compilation
namespace foo static bool const exists = true;}typedef get_my_type_or_default<foo::exists, void>::type my_type_or_default; 目标是让my_type_or_default计算为f
浏览 4
提问于2014-08-01
得票数 3
回答已采纳
1
回答
溢出是因为加法造成
的
?
c
、
math
、
integer-arithmetic
你好,对不起,这篇文章
的
标题太烂了,只是找不到更好
的
标题。 typedef long long <e
浏览 2
提问于2020-03-09
得票数 0
回答已采纳
2
回答
创建std类型
的
向量::any
c++
、
vector
、
c++17
、
stdany
std::vector<decltype(myMap[TYPE::
INT
8])> vec; 在这个例子
中
,我有一个映射,从某个枚举到std::any。实际上,我需要一个灵活
的
数据结构,它可以从特定类型(本例
中
的
enum TYPE)映射到多个数据类型(不同类型
的
int
),从而使用std::any。 接下来,我想确定密钥
的
值类型,并用它构造一个向量。我希望从std::any中提取“真类型”,并创建该类型
的
向量。我怎样才能
浏览 11
提问于2022-10-22
得票数 0
1
回答
如何强制对带有类型别名
的
模板类进行实例化
c++
、
templates
我有一个模板类,它接受大量
的
模板参数。我怎么能这么做?class T { // alias the type so that the user don't get mad
浏览 4
提问于2022-07-01
得票数 1
3
回答
在位字段中使用枚举安全吗?
c++
、
c
、
enums
、
bit-fields
c;
unsigned
int
d2 :4;
unsigned
int
d4 :23;字段d3当前由从0x00到0x0D
的
#define定义。所以我们很想继续去取代
unsigned
浏览 4
提问于2012-08-16
得票数 32
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
C+中的 atoi和itoa
C/C+编程笔记:C语言结构体—位域,如何指定成员变量所占Bit?
C语言数据类型和java的有什么不同,案例分析
C语言编程学习变量与基本数据类型
日常踩坑:一场C+实现KMP算法引发的“血案”
热门
标签
更多标签
云服务器
即时通信 IM
ICP备案
对象存储
实时音视频
活动推荐
运营活动
广告
关闭
领券