templates

Template specialization of a single method from a templated class

Hello. Always considering that the following header, containing my templated class, is included in at least two .CPP files, this code compiles correctly: template <class T> class TClass { public: void doSomething(std::vector<T> * v); }; template <class T> void TClass<T>::doSomething(std::vector<T> * v) { // Do somtehing with a vect...

How to define abstract base classes for arbitrary (but compile time defined) features support?

I have the following C++ design problem and I would really appreciate any suggestion/solution. Please notice that my background is not in computer science, so I may be missing some obvious solution. The way I usually separate key components in the code is to define interfaces via abstract classes and pure virtual functions. Example1: ...

Splitting templated C++ classes into .hpp/.cpp files - is it possible?

g++ -c -o main.o main.cpp g++ -c -o stack.o stack.cpp g++ -o main main.o stack.o main.o: In function `main': main.cpp:(.text+0xe): undefined reference to 'stack::stack()' main.cpp:(.text+0x1c): undefined reference to 'stack::~stack()' collect2: ld returned 1 exit status make: *** [program] Error 1 stack.hpp: #ifndef _STACK_HPP #defin...

Templates, nested classes, and "expected constructor, destructor, or conversion before '&' token"

While working with some templates and writing myself a basic container class with iterators, I found myself needing to move the body of member functions from a template class into a separate file to conform to style guidelines. However, I've run into an interesting compile error: runtimearray.cpp:17: error: expected constructor, de...

Template Classes in C++ ... a required skill set?

I'm new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly? ...

I have to generate PL/SQL using Java. Most of the procedures are common. Only a few keeps changing. How to do that?

I have to generate PL-SQL code, with some common code(invariable) and a variable code. I don't want to use any external tools. Some ways that I can think: Can I go and maintain the common code in a template and with markers, where my java code will generate code in the markers and generate a new file. Maintain the common code in stati...

templated class can't redefine operator[]

I've this class namespace baseUtils { template<typename AT> class growVector { int size; AT **arr; AT* defaultVal; public: growVector(int size, AT* defaultVal ); //Expects number of elements (5) and default value (NULL) AT*& operator[](unsigned pos); int length(); void reset(int pos); //Reset...

c++ templated class does not link

template<typename AT> class growVector { int size; AT **arr; AT* defaultVal; public: growVector(int size , AT* defaultVal); //Expects number of elements (5) and default value (NULL) AT*& operator[](unsigned pos); int length(); void reset(int pos); //Resets an element to default value void ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I've wasted several hours now trying to create control templates only to find that the control doesn't support the template property. By "doesn't support" I mean: <Style x:Key="blah" TargetType="Border"> <Setter Property="Template"> ...

ASP.NET MVC Email

Is their a solution to generate an email template using an ASP.NET MVC View without having to jump through hoops. Let me elaborate jumping through hoops. var fakeContext = new HttpContext(HttpContext.Current.Request, fakeResponse); var oldContext = HttpContext.Current; HttpContext.Current = fakeContext;...

How to create a submit button template in Oracle APEX?

Hey all, I'm trying to create a template for a button in Oracle APEX but I don't seem to have access to the appropriate substitution strings to make it work. For non-templated buttons APEX seems to insert a handler for the onclick event that calls doSubmit('buttonName') Unfortunately, when I go to create a template the only substituti...

error: ISO C++ forbids declaration of ‘iterator’ with no type

Hi, I am trying to build/run an old C++ system. I've already been able to built it in Ubuntu 9.10 with g++4.4 Now I'm trying to build in Ubuntu 8.04 with g++4.2. And I am getting the following errors: stringmap.h:353: erro: ISO C++ forbids declaration of ‘iterator’ with no type stringmap.h:353: erro: extra qualification ‘stringmap<_Tp>...

What is the reason for the entire C++ STL code to be included in the .h rather than .cpp/.c files?

I just downloaded the STL source code and I noticed all the definition for the STL template classes are included in the .h file. The actual source code for the function definition is in the .h file rather than .cpp/.c file. What is the reason for this? http://www.sgi.com/tech/stl/download.html ...

Django url template tag: 'module' object has no attribute 'views'

The tag in question: < a href="{% url django.contrib.auth.views.login %}">Login< /a> URLConf: from django.contrib.auth import views ... (r'^login/$',views.login, {'redirect_field_name' : '/' }) ... ...

Is it possible to choose a C++ generic type parameter at runtime?

Is there a way to choose the generic type of a class at runtime or is this a compile-time thing in C++? What I want to do is something like this (pseudocode): Generictype type; if(somveval==1) type = Integer; if(someval==2) type = String; list<type> myList; Is this possible in C++? and if yes, how? ...

Different implementation of a templated class method for a particular class template type

I have a templated class with a method for which I need a different implementation for a specific template type. How do i get it done? ...

PHP html email, using html template

so i'm trying to do a do a html mail sytem and my html i want to be a template, stored in a separate file like : <div clas="headr"></div> <div class="content"></div> <div class="footer"></div> when i want to send the mail i want my mail content(from the input form) to go in that div.content and then to send the whole html(template...

C++ implicit template instantiation

I currently have a class hierarchy like MatrixBase -> DenseMatrix -> (other types of matrices) -> MatrixView -> TransposeView -> DiagonalView -> (other specialized views of matrices) MatrixBase is an abstract class which forces implementers to define operator()(in...

Template Parsing and Reflection

I'm writing a content management system in ASP.NET/C# which the template of the site is defined in a html file. I am passing parameters to the html file with blocks. A block starts with [ and ends with ]. An example for a template with some simple blocks: <html> <head> <title>[Title]</title> <meta name="description" content="[De...

Sticky footer with CSS Layout Template Module?

I'm currently looking into the JQuery library for CSS Layout Template module Is it possible to define the height of a placeholder with *? Meaning it will push content down if it has to, or fill up any remaining space if the complete content is less then the view port. This would be really nice to make the whole sticky footer thing mu...