templates

create map using two array

i am trying to create map using two array here is code #include <algorithm> #include <iostream> #include <map> #include <utility> #include <iterator> #include <string> using namespace std; using std::transform; int main(){ const char* word[]={"A","B","C","D","E"}; const char * clue[]={"a","b","c","d","e"}; map<string,strin...

How to change templatized controls using styles

Hi, I'm using a ControlTemplate for defining the appearance of my buttons in a WPF application. Additionally I would like to use styles to set certain aspects of my buttons. These styles should set properties on elements defined in the ControlTemplate, like (simplified): <Window.Resources> <ControlTemplate x:Key="Template1" TargetTy...

Template parameter constraints

Hi, I've been reading through this advice about template parameter constraints and was confused by this line: template<class T> class Container : Derived_from<T,Mybase> { // ... }; What's going on here? Is this just plain old inheritance being used to make the compiler examine Derived_from to perform the desired check? Why does ...

Is there a template hiearachy in Wordpress similar to Django?

I'm a veteran Django programmer and a newbie in WordPress. In Django, we have the concept of templating such that I can create File1 which contains some html blocks that can be overriden by child File2. We are using {block block1} syntax in Django. This makes re-use in django very easy. In PHP (WordPress) do we have the same concept? I w...

Type condition in C++ template class problem

Hello, Using GCC 4.2. I have this metatemplate for conditional type: template <bool condition, typename Then, typename Else> struct IF { typedef Then RET; }; template <class Then, class Else> struct IF<false, Then, Else> { typedef Else RET; }; and when I use it like this: template <typename T> class Param { IF< sizeof(i...

Problem by a reference variable of a template parameter

The following small example shows my problem: template<class T> struct X { static void xxx(T& x) { } static void xxx(T&& x) { } }; int main(int argc, char** argv) { int x = 9; X<int>::xxx(x); // OK. X<int&>::xxx(x); // ERROR! return 0; } Error message (GCC): error: ‘static void X::xxx(T&&) [with T = int&]’...

Different template error format in GCC?

GCC has a very verbose format for certain template error messages: ... some_class<A,B,C> [with int A = 1, int B = 2, int C = 3] Any chance to make it show something like: ... some_class<1,2,3> ...

Templated Class has a Circular Dependency

I have two classes. One is a management class, which stores a bunch of worker classes. The workers are actually a templated class. #include "worker.h" class Management { private: worker<type1> worker1; worker<type2> worker2; ... }; The problem arises due to the fact that the templated classes needs to u...

Node template for blog teaser node

I'm trying to create a teaser node template to display all Blog teasers. For the page tpl I have page-blogs.tpl.php For the Blog node tpl I have node-blog.tpl.php (This one is looping to display all the blog teasers) Now how do I create a node template to surround the node teasers? My URL for the page with all the blog teasers is: /blog...

How to disable formatting for FloatField in template for Django

Hi everyone, i just can't seem to find a definitive answer to this issue, and django's irc needs auth to services... So my question is : how can you force some kind of formatting for FloatFields in template when you're using Django ? The problem is simple i need simple dot separated numbers like this : 42547.34 And i end up with comma ...

Django, automatic HTML "sanitizing" when putting HTML to template, how to stop it?

I'm kind of confused by this because it seems that Django templates have optional HTML filters but this seems to be happening automatically.. I am making this demo app where the user will do an action that calls a python script which retrieves a url, I then want to display this in a new window.. its all fine except when the display comes...

Can I create a usercontrol that is available only inside a template?

Anyone have an idea how I can create a usercontrol that is only available inside the template of another user control? The best example I can think of is the PostBackTrigger and AsyncPostbackTrigger. These "controls" are only available inside the Triggers "template" of the UpdatePanel. Basically, I want to be able to include placeholder ...

How to change WPF DataGrid cell widget background color according to cell background color?

The background I use VS2010, DataGrid (the one delivered with WPF) and I manually create rows and columns. I set various colors for rows, depending of their state (but for simplicity let's say it was yellow). It worked because datagrid used labels for displaying text, and when I set background for row, it is reflected in label widget as...

Ambiguous call if class inherits from 2 templated parent classes. Why?

I have a templated class that performs an action on the class that is given as template argument. For some of my classes I want to 'group' the functionality in one class, to make it easier for the caller. In fact the code looks something like this (names were changed): template<typename T> class DoSomeProcessing { public: process(T...

Drupal node template for webform

I'm trying to give my webform node a readable name to make it easier to find and edit. I'm able to use the template I created called "webform-form-12.tpl.php" and theme that, but I want to use something like "node-webform-form-athlete-of-the-month_submit-your-athlete.tpl.php". The path I gave this webform is "athlete-of-the-month/submit-...

generate word document file from template having .dot file template.

Hi , I am working on a requirement where I have to generate word document file from template having .dot extension. I have gone through all the options available on internet but did not get the sound examples and ideas. I am lacking information on it hence not able to go forward. Please guide me regarding the same. I have to complete...

Template to show method name and parameter values in Eclipse

Is there any way to have a template (Java -> Editor -> Templates) in Eclipse that generate something like this debug("methodName arg1=" + arg1 + " arg2=" + arg2 + " arg3=" + arg3); When used in a method. For instance: public void setImage(long rowId, long contactId, String thinggy) { // invoking the template here, produces this: ...

template specialized on a namespace

Given: namespace A { class Foo; class Bar; } namespace A { class Foo; class Bar; } I want to template a class on the namespace A or B such that the following works: template<name> class C { name::Foo* foo; name::Bar* bar; } Can this be done directly or do I need to create a pair of struct types with typedefs in them? ...

How can I abstract out a repeating try catch pattern in C++

I have a pattern that repeats for several member functions that looks like this: int myClass::abstract_one(int sig1) { try { return _original->abstract_one(sig1); } catch (std::exception& err) { handleException(err); } catch (...) { handleException(); } } bool myClass::abstract_two(int sig2) { try { return _or...

What detectable differences are there between a class and its base-class?

Given the following template: template <typename T> class wrapper : public T {}; What visible differences in interface or behaviour are there between an object of type Foo and an object of type wrapper<Foo>? I'm already aware of one: wrapper<Foo> only has a nullary constructor, copy constructor and assignment operator (and it only ...