什么是<>在课堂上? [英] What are <> in classes?

查看:102
本文介绍了什么是<>在课堂上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学习矢量时看到了这些,它们定义了矢量中的变量类型。

我认为它可能有助于功能。



顺便说一句。

有没有办法让函数返回多种变量类型?



我尝试了什么:



我找不到任何描述这个的东西。

I saw these while I was learning about vectors, where they define the type of variables in the vector.
I thought that it might help with functions.

btw.
Is there a way for a function to return multiple variable types?

What I have tried:

I can't find anything describing this.

推荐答案

当你知道要搜索什么时,这很容易! :)



模板(C ++) - 维基百科 [< a href =https://en.wikipedia.org/wiki/Function_templatetarget =_ blanktitle =New Window> ^ ]

模板参数和模板参数 - cppreference.com [ ^ ]

白痴的C ++模板指南 - 第1部分 [ ^ ]
It's easy when you know what to search for! :)

Template (C++) - Wikipedia[^]
Template parameters and template arguments - cppreference.com[^]
An Idiot's Guide to C++ Templates - Part 1[^]


引用:

有没有办法让函数返回多个变量类型?

Is there a way for a function to return multiple variable types?

是的,如果我找到你:模板函数可能会做那。例如,请参阅:功能模板 - cppreference.com [ ^ ]。

Yes, if I got you: a template function may do that. See, for instance: Function template - cppreference.com[^].


这篇关于什么是&lt;&gt;在课堂上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆