function-templates
Determination of type in function template
I would like to ask you for an advice about function template. I have a function that adds some data into buffer. But I need also to add an information about data type into the buffer. The type of dat[详细]
2023-01-22 18:58 分类:问答Logical error in Function template
My professor has given me this assignment. Implement a generic function called Max, which takes 3 arguments of generic[详细]
2023-01-19 10:32 分类:问答Error in template function (using Boost.Tuples)
#include <list> #include <boost/tuple/tuple.hpp> template<class InputIterator> void f(InputIterator it)[详细]
2023-01-08 17:11 分类:问答Is there a C++ equivalent to Java's Collection interface for STL container classes?
I wo开发者_运维技巧uld like to pass arbitrary container as an argument of function and iterate over it (no erasing nor pushing elements). Unfortunately it looks like there is no standard way of doing[详细]
2023-01-04 11:47 分类:问答Template function in C# - Return Type?
It seems that c# does not support c++ like templates. For example template <class myType> myType GetMax (myType a, myType b) {[详细]
2023-01-03 19:21 分类:问答How to use class templates as function arguments?
I have a class declared along the lines of template<int a, int b> class C { public: array[a][b]; } and I want to use it as argument in a function like this:[详细]
2022-12-29 14:50 分类:问答class T in c++ (your definition)
The one advantage of using class T in 开发者_如何学Cc++ is to reduce the time to redefine data types in a function, if those data types are defined in other function, for example, in int main.[详细]
2022-12-24 13:48 分类:问答Using typedefs from a template class in a template (non-member) function
The following fails to compile (with gcc 4.2.1 on Linux, anyway): template< typename T > class Foo[详细]
2022-12-22 07:33 分类:问答Can a class member function template be virtual?
I have heard that C++ class member function templates can\'t be virtual.Is this true? If th开发者_Go百科ey can be virtual, what is an example of a scenario in which one would use such a function?Tem[详细]
2022-12-22 00:11 分类:问答How to get an object of a unknown class with given classname
I am searching for a way to determine at runtime, which type of object should be alloced (based on a given class name, which is of type const char*).[详细]
2022-12-17 16:35 分类:问答