templates

virtual methods and template classes

Hi I got over a problem, I think a very specific one. I've got 2 classes, a B aseclass and a D erived class (from B aseclass). B is a template class ( or class template) and has a pure virtual method virtual void work(const T &dummy) = 0; The D erived class is supposed to reimplement this, but as D is Derived from B rather than D bein...

gcc returns error with nested class

Howdy, I am attempting to use the fully qualified name of my nested class as below, but the compiler is balking! template <class T> class Apple { //constructors, members, whatevers, etc... public: class Banana { public: Banana() { //etc... } //other constructors, members, etc... }; };...

question about c++ template functions taking any type as long that type meets at least one of the requirements

Since i cant explain this very well, i will start with a small example right away: template <class T> void Print(const T& t){t.print1();} template <class T> void Print(const T& t){t.print2();} This does not compile: error C2995: 'void Print(const T &)' : function template has already been defined So, how can i create a template func...

C++ -- typedef "inside" template arguments?

Imagine I have a template function like this: template<typename Iterator> void myfunc(Iterator a, typename Iterator::value_type b) { ... } Is there a way to implement the same thing by declare a typedef for Iterator::valuetype that I can use in the function signature? For example, I'd prefer to be able to do something like this: tem...

Why is partial specialziation of a nested class template allowed, while complete isn't?

template<int x> struct A { template<int y> struct B {};. template<int y, int unused> struct C {}; ...

C++: Template functor cannot deduce reference type

I've got a functor f, which takes a function func and a parameter t of the same type as func. I cannot pass g to f because of compilation error (no matching function for call to f(int&, void (&)(int&)) ). If g would take non-reference parameter g(int s), compilation finishes. Or if I manually specify template parameter f<int&>(i, g), com...

ObjectiveC builtin template system ?

I am developing an iPhone application and I use HTML to display formatted text. I often display the same webpage, but with a different content. I would like to use a template HTML file, and then fill it with my diffent values. I wonder if ObjectiveC has a template system similar to ERB in Ruby. That would allow to do things like Temp...

C++ list<T>::iterator cant be used in derived class template

g++ compiler gives this error: expected `;' before 'it' template <typename T> class myList : public std::list<T> { public: void foo () { std::list<T>::iterator it; // compiler error as above mentioned, why ??? } }; Thanks. ...

Solving a difficult incomplete type error

I get an incomplete type error when trying to compile my code. I know that it is related to includes, but my project is large and it uses several templates so I can't find which type is actually incomplete. The error message doesn't help either: Compiling: ../../../addons/ofxTableGestures/src/Graphics/objects/CursorFeedback.cpp In file ...

PHP Menu Question

As one of the steps toward a greater website redesign I am putting the majority of the content of our website into html files to be used as includes. I am intending on passing a variable to the PHP template page through the URL to call the proper include. Our website has many programs that each need an index page as well as about 5 sub...

Explicitly instantiating a generic member function of a generic structure

I have a structure with a template parameter, Stream. Within that structure, there is a function with its own template parameter, Type. If I try to force a specific instance of the function to be generated and called, it works fine, if I am in a context where the exact type of the structure is known. If not, I get a compile error. ...

Opening new window in HTML for target="_blank"

<a href="facebook.com/sharer" target="_blank" >Share this</a> How do I make this a certain width and height, in a new window, when the user clicks on it? In firefox, the current code only opens up a new tab (not a new window) ...

ItemsControl ItemsTemplate vs ContentTemplate

Hi, Is there any difference between setting the ContentTemplate of a ListBoxItem, compared to setting the ItemsTemplate on the ListBox? Or is it just a preference? Just say you set the ItemsTemplate of the ListBox can you still get the Data Template you assigned to the ListBox ItemsTemplate via the ListBoxItems ContentTemplate? ie. Li...

problem understanding templates in c++

Template code is not compiled until the template function is used. But where does it save the compiled code, is it saved in the object file from which used the template function in the first place? For example, main.cpp is calling a template function from the file test.h, the compiler generates an object file main.o, Is the template fu...

c++ global operator not playing well with template class

ok, i found some similar posts on stackoverflow, but I couldn't find any that pertained to my exact situation and I was confused with some of the answers given. Ok, so here is my problem: I have a template matrix class as follows: template <typename T, size_t ROWS, size_t COLS> class Matrix { public: template<typename, ...

Cheetah pre-compiled template usage quesion

For performance reason as suggested here, I am studying how to used the pr-compiled template. I edit hello.tmpl in template directory as #attr title = "This is my Template" \${title} Hello \${who}! then issued cheetah-compile.exe .\hello.tmpl and get the hello.py In another python file runner.p...

Where to find free html templates to support multiple resolutions/browsers?

Is there a website where I can download free css/html templates for a website to support multiple browsers and resolutions? (I want to make sure I can make use of client's entire screen and not show my website in the middle with "spares" on the sides) ...

c++ template and its element type

This is my template matrix class: template<typename T> class Matrix { public: .... Matrix<T> operator / (const T &num); } However, in my Pixel class, I didn't define the Pixel/Pixel operator at all! Why in this case, the compiler still compiles? Pixel class #ifndef MYRGB_H #define MYRGB_H #include <iostream> using namespace std; ...

Differences between template class implemenations in C++ on Linux and MSVC Win32

I'm trying to port some old Linux code to run on Windows and am running into a whole bunch of compiler errors that seem to be stemming from the considerable use of template classes. Are there really any significant differences between how templates must be implemented for linux vs MSVC? If so, could someone give an overview of what's a...

Whats a good E-Commerce Cart

Whats a good Shopping Cart possibly free i know there oscommerce, xcart etc but whats a good one? and fairly easily to implement maintain and edit possibly merge with in my sites current theme. If you mean technology as in web language which I hope you do than it's php. other then that i have no clue what you mean apache/mysql? amd? lol...