FAQ Database Discussion Community

Explicit instantiation of class template not instantiating constructor

I'm working on a project in C++ and am having trouble understanding what members of a template class get explicitly instantiated when I explicitly instantiate the template class. I've written the following file, which I then compile using Visual C++ 2008 Express Edition's Release configuration and then pop into a...

Using function-templated code across the g++-nvcc boundary (including kernels)

Suppose I compile the following with NVIDIA CUDA's nvcc compiler: template<typename T, typename Operator> __global__ void fooKernel(T t1, T t2) { Operator op; doSomethingWith(t1, t2); } template<typename T> __device__ __host__ void T bar(T t1, T t2) { return t1 + t2; } template<typename T, typename Operator> void foo(T t1, T...

explicit instantiation of a function template having integers as template parameters

I am trying to explicitly instantiate a function template. Please see the code snippet main.cpp: void func(int * ); int main() { int m = 3, n = 5; int *ptr; ptr = &m; func(ptr); //function call <do-Something> ..... ..... } The func() function is in this cpp file func.cpp...