templates

Specialization of template after instantiation?

Hi, My full code is too long, but here is a snippet that will reflect the essence of my problem: class BPCFGParser { public: ... ... class Edge { ... ... }; class ActiveEquivClass { ... ... }; class PassiveEquivClass { ... ... }; struct EqActiveEquivClass { ... ... }; struc...

specialization on const member function pointers

I am trying to specialize some utility code on const member functions, but have problems to get a simple test-case to work. To simplify the work i am utilizing Boost.FunctionTypes and its components<FunctionType> template - a MPL sequence which should contain the tag const_qualified for const member functions. But using the test-code be...

Looking for a good website template site

I'm looking for a professional template for a company website. It can be paid for or free. Where can I find the best looking templates? ...

Overriding multiple inherited templated functions with specialized versions

Okay, sample code first; this is my attempt at communicating what it is that I'm trying to do, although it doesn't compile: #include <iostream> template <class T> class Base { public: virtual void my_callback() = 0; }; class Derived1 : public Base<int> , public Base<float> { public: void my_callback<int>() { cout << "Int callba...

C++ templates and ambiguity problem

I have a subset of a pointer class that look like: template <typename T> struct Pointer { Pointer(); Pointer(T *const x); Pointer(const Pointer &x); template <typename t> Pointer(const Pointer<t> &x); operator T *() const; }; The goal of the last constructor is to allow to pass a Pointer of a subclass, o...

[GAE]How to set `inline` if in template

Hi, Coming from PHP world, I used to create select box like this: <select> <?php foreach($arrField as $idx=>$val){?> <option <?php echo ($fieldVal == $idx ? "selected='selected'" : ''); ?>><?php echo $val; ?></option> <?php } ?> </select> However, I can't do that in python. Here's my snippet: <select name='type'> <option value...

Nested blocks in Django templates

The master template in my Django app looks like this: {% block parent %} Some text... {% block child %} Default content here... {% endblock child %} ...some more text {% endblock parent %} Now, this template should be overwritten in a way that the child block is changed: {% extends "master.html" %} {% block c...

Min and Max values for integer variable at compile time in C++

Is there a simple, clean way of determining at compile time the max and min values for a variable of some (otherwise unknown at the moment) integer variable or type? Using templates? For example: // Somewhere in a large project is: typedef unsigned long XType; typedef char YType; // ... // Somewhere else XType a; YType b; LON...

C++ template specialization of constructor

I have a templated class A<T, int> and two typedefs A<string, 20> and A<string, 30>. How do I override the constructor for A<string, 20> ? The following does not work: template <typename T, int M> class A; typedef A<std::string, 20> one_type; typedef A<std::string, 30> second_type; template <typename T, int M> class A { public: A(...

Inheriting from a virtual template class in C++

How do I inherit from a virtual template class, in this code: // test.h class Base { public: virtual std::string Foo() = 0; virtual std::string Bar() = 0; }; template <typename T> class Derived : public Base { public: Derived(const T& data) : data_(data) { } virtual std::string Foo(); virtual std::string Bar(); T data()...

Why is php_template_preprocess_page function not called in Drupal 6x?

From another forum I found the following example: "I was looking for a way to pull node data via ajax and came up with the following solution for Drupal 6. After implementing the changes below, if you add ajax=1 in the URL (e.g. mysite.com/node/1?ajax=1), you'll get just the content and no page layout. in the template.php file for y...

Drupal - General means for finding templates?

Given that I have a URL to a page and I can see the content on it as a user, is there a simple way to find out what template files are producing the page? Ideally I would like to know three things: The current template file(s) being used The filename(s) I can create in the local folder to customize them What variables are available to ...

specializing functions on stl style container types

If i have a type T, what is a useful way to inspect it at compile time to see whether its an STL-style container (for an arbitrary value type) or not? (Assumption: pointers, reference, etc. already stripped) Starting code: template<class T> // (1) void f(T&) {} template<class T> // (2) void f(std::vector<T>&) {} void test() { ...

Supress unused variable warning in C++ => Compiler bug or code bug?

Presently, I am using the following function template to suppress unused variable warnings: template<typename T> void unused(T const &) { /* Do nothing. */ } However, when porting to cygwin from Linux, I am now getting compiler errors on g++ 3.4.4 (On linux I am 3.4.6, so maybe this is a bug fix?): Write.cpp: In member function `vo...

Literals in django template language?

If I want some text to appear literally in a Django template, e.g. {{Image.jpg|title}} and I want that text to be output (not interpretated) in the HTML, how do I do so? ...

To change template through Ajax in Symfony

there are two templates i am using for view and edit(is having the form to update), the view will contain edit(link or button), on clicking the edit button i want that the edit template should be loaded (using Ajax, without refreshing the page). and after editing it should be redirected to view again (using ajax same as above). is there...

how to cut email template for outllook from psd

hello. i am having a hardtime cutting up a layout for outlook. it's an email template. it looks fine on gmail, but the width stretches when i check it in outlook 07. anyone have any tips on how i should go about this? BTW, i am using ps cs3 save for web & device to output the html and images ...

Silverlight Button Style gets stuck on fullscreen

So I have a number of buttons in Silverlight that I've made from images. In each case the button has a regular image and a hover image. I've used Blend to have the hover image fade in over .15 seconds on hover. The problem with this is that I can't figure out how to access the images anymore, since they are embedded in the style. So, I...

Can a Grails Layout call a template?

I want my main layout to conditionally put in some blocks of html that I want to be defined in a separate file. I have more than one kind of navigation bar defined. I want to have a file for each navigation bar. Then I want to just set a variable in my controller or specific gsp file so that the layout chooses which navigator to use. ...

C++ fancy template code problem

Hi! I try to get a (for me) rather complex construct of templated code to work. what i have: a class shaderProperty of generic type class IShaderProperty { public: virtual ~IShaderProperty() {} }; struct IShaderMatth; //forward declaration template<typename ShadeType> struct ShaderMatth;//forward declaration template <typename T> c...