Template specialization


I've two modules in my project. One is a dll and another is an exe. The dll contains the following template code in one of its header file. #ifndef __STACK_HEADER__ #define __STACK_HEADER__ template< class T> class Stack { public: ...
Posted On: Monday 26th of November 2012 12:47:51 AM Total Views:  271
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




Repeating template parameter

, I guess this is a pretty vague question but I stumble on it a couple of times and never really knew what was a nice solution to it. I am trying to avoid passing twice a template parameter ...
VIEWS ON THIS POST

118

Posted on:

Sunday 25th November 2012
View Replies!

template: no matching function call. Converting const value to constreference.

template ContainerType rsa_encrypt_list(const std::string&, const typename ContainerType::reference, const typename ContainerType::reference); const BigInteger e(boost::lexical_cast(rsa_encrypts[2])); const BigInteger n(boost::lexical_cast(rsa_encrypts[1])); std::string infile(rsa_encrypts[0]); boost::scoped_ptr encrypt_input(new boost::filesystem::ifstream(infile)); const std::string plaintext(std::istreambuf_iterator(encrypt_input->rdbuf()), std::istreambuf_iterator()); std::list decrypted_list(encryptcpw::rsa_encrypt_list >(plaintext, e, n)); // this is line 64. std::vector(ciphertext).swap(ciphertext); // ... ...
VIEWS ON THIS POST

131

Posted on:

Sunday 25th November 2012
View Replies!

why std::sort take no template parameter to swap?

! I wonder why there is no such a overload version of sort function in STL: template void sort( RandomAccessIterator _First, RandomAccessIterator _Last, BinaryPredicate _Comp, IterSwap _Swap ); It seems that std::sort works ...
VIEWS ON THIS POST

133

Posted on:

Sunday 25th November 2012
View Replies!

Using array variables as a non-type template arguments

I need a template class taking several non-type arguments. Then I want to be able to pass these arguments to the constructor of another non- template class. So far I have this (I did some editing to simplify the ...
VIEWS ON THIS POST

123

Posted on:

Sunday 25th November 2012
View Replies!

[ANN] Boost.Xpressive 2.0, advanced regular expression template library

I've just released a new version of Boost.Xpressive. << Description >> Xpressive allows you to write your regular expressions as strings to be parsed at runtime, or as expression templates parsed at compile time. Regular expressions can nest and call ...
VIEWS ON THIS POST

144

Posted on:

Sunday 25th November 2012
View Replies!

hiding non template dependent implementation in a template class

hi, suppose i have a) template class B{ A* public: /* depends on T*/ }; or b) class B{ A* public: template double f(T&); /* impl depends on T */ }; -if the template was not there i ...
VIEWS ON THIS POST

131

Posted on:

Sunday 25th November 2012
View Replies!

template question: preallocation for the underlying deque in user-defined queue

Heck wrote: > I borrowed N. Josuttis's code for a queue ("The C++ Standard Library", > 1999, p. 450), with which he modifies the interface to read and > discard the front element on pop() and to throw an exception ...
VIEWS ON THIS POST

200

Posted on:

Sunday 25th November 2012
View Replies!

ambiguity in multiple template base classes, where can I find some information in C++ the standard?

Hi all, I have tried to look for some info related to template base classes in the standard but with no luck. May you please give me some hints The following code compiles well with my compiler but leads to ...
VIEWS ON THIS POST

152

Posted on:

Sunday 25th November 2012
View Replies!

template metaprogramming and recursive inheritance

any ideas why this does not compile: template struct S; template <> struct S<0> { S<0>(void): y(0) {} int y; }; template struct S: public S { S(void) {y++;} }; The error that ...
VIEWS ON THIS POST

161

Posted on:

Sunday 25th November 2012
View Replies!

Partial template specialization

Hi I have a class template Foo with 10 non-static member methods. Foo needs to be partially specialized because the implementation of some (perhaps 2 or 3) of the methods in the primary template is not appropriate for the specialized ...
VIEWS ON THIS POST

107

Posted on:

Sunday 25th November 2012
View Replies!

template template par used for a container statistic

hi, a) what's wrong with this code it looks like allocator is the problem. the commented version works fine, but if possible i'd rather not limit myself to ublas::vector b) the version that works is slow compared to mathematica. is ...
VIEWS ON THIS POST

141

Posted on:

Sunday 25th November 2012
View Replies!

template template parameters

Could someone please explain template template parameters, showing: 1). Why they are needed / i.e what problem do they solve 2). A simple example I have read various articles etc, but it still dosen't seem to make sense to ...
VIEWS ON THIS POST

100

Posted on:

Sunday 25th November 2012
View Replies!

C++ template metaprogramming in C#?

I found a concept named template metaprogramming that can be used in C+ + code at compile-time. I am a beginner at C++. But I am a programmer on the .NET platform. Do you know if template metaprogramming is ...
VIEWS ON THIS POST

129

Posted on:

Sunday 25th November 2012
View Replies!

Problems with template specializations.

Please check the following snippet.. template class CheckUni { public: void This() { std::cout << "Basic type\n"; } }; template class CheckUni< CheckUni > { public: void This() { std::cout << "CheckUni type\n"; } }; CheckUni ...
VIEWS ON THIS POST

167

Posted on:

Sunday 25th November 2012
View Replies!

recursiveness on template member function of a template class

Hi all, I am trying to do that, but it does not compile. I am not even sure this is possible. I have read somewhere that specialization inside a template class is not without specializing the class itself, but couldn't ...
VIEWS ON THIS POST

144

Posted on:

Monday 26th November 2012
View Replies!

template and NULL

Hi , I've simple function template void testNull( T a ) { } and code that use it { testNull ( NULL ); }; gcc deduce type T as int in that case. And give me "passing NULL ...
VIEWS ON THIS POST

95

Posted on:

Monday 26th November 2012
View Replies!

extensible math functions: variable number of arguments and class templates

I have a couple of questions about using a variable number of arguments in a function call (...). The context is that I have some mathematical functions I created. I currently pass them a pair of numbers (doubles), and the ...
VIEWS ON THIS POST

157

Posted on:

Monday 26th November 2012
View Replies!

partially specializing member functions of a template class

Is there a way to partially specialize only a member function of a template class (not the whole class). e.g. template class Base { public: void fun (int key ) {cout<<"inside the template class\n"; } ...
VIEWS ON THIS POST

131

Posted on:

Monday 26th November 2012
View Replies!

specialaizing templates --error

, I 'm writitng a simple program which contains the following template template int exch(T& t1 ,T& t2){ T tmp ; tmp = t1; t1 = t2; t2 = tmp; return 1; } When i run this for ...
VIEWS ON THIS POST

356

Posted on:

Monday 26th November 2012
View Replies!

Vectorization of template functions

all, I am attempting to vectorize few template functions with the Intel compiler, but without much success so far. Ok granted, this question is not 100% c++, but it is related enough that I felt I could post it ...
VIEWS ON THIS POST

86

Posted on:

Monday 26th November 2012
View Replies!