templates

Templates :Name resolution:Dependent template arguments : -->can any one tell some more examples for this statement?

This is the statement from ISO C++ Standard 14.6.2.4: Dependent template arguments : A type template-argument is dependent if the type it specifies is dependent. An integral non-type template-argument is dependent if the constant expression it specifies is value dependent. A non-integral non-type template-argument...

CKEditor : How to apply/load automatically a template in the editor ?

Hello everyone, I'm using the WYSIWYG editor CKeditor in one of my websites. In order to be more user friendly, I would like to load automatically a specific template each time the editor is used. The customer has to apply this template in order to have a good integration with the rest of the website (which is designed with content disp...

Lightweight template engine in Java

I am looking for a lightweight template engine in Java. I want to be to give my users the ability to define a template in the line of: "Some arbitrary text ${some_function(Some more text ${1}, function_param)} whatever" And the template will be compiled and filled in runtime. Requirements are: Template accepts array of objects as pa...

Suggestions for tiny CMS for programmers to set up and inexperienced users to use?

Once in a while, I get a request from a friend or family member who want me ("The IT guy") to set up a really simple web page for them, usually based on a free/cheap web design template. Does anyone have a recommendation on a choice of CMS? I have used Wordpress and CMS Made Simple earlier, but both interfaces are a bit advanced for the...

Help needed with container for a generic item in C++

I wonder if it is possible to define a generic C++ container that stores items as follows: template <typename T> class Item{ typename T value; } I am aware that the declaration needs the definition of the item type such as: std::vector<Item <int> > items; Is there any pattern design or wrapper that may solve this issue? ...

How can I convert .strings files to and from .po and .pot files?

How can I convert .strings files to and from .po and .pot files? ...

Problem with template specialization and template template parameters

I have a class Helper: template <typename T, template <typename> E> class Helper { ... }; I have another class template, Exposure, which is to inherit from Helper while passing itself as the template template parameter E. I also need to specialize Exposure. Thus I want to write something like the following: template <> class Ex...

Difference between template name and template id

C++ Standard Section 14/2 : In a function template declaration, the declarator-id shall be a template-name (i.e., not a template-id). [Note: in a class template declaration, if the declarator-id is a template-id, the declaration declares a class template partial specialization. What is the difference b...

How to call controller function from template in Django?

How to call controller function from template in Django instead of hardcoding URIs? ...

return modified value from a function template error

My code is something like this: // ... code template <int i> int modifyparameter() { i = i++; return i; } // ... some more code int main() { int answer = modifyparameter<5>(); cout << answer; //expecting 6 } But I am getting errors. What have I done wrong? ...

C++ boost enable_if question

Hello! Do I have any way to simplify the following statements? (probably, using boost::enable_if). I have a simple class structure - Base base class, Derived1, Derived2 inherit from Base. I have the following code: template <typename Y> struct translator_between<Base, Y> { typedef some_translator<Base, Y> type; }; template <typen...

template inheritance c++

hey everyone :) i am a new programmer in c++. and i am using templates for the first time. i have an abstract class and another class extending it. but all the protected members of the abstract class are not recognised by the other class: class0.h: template<class T> class class0 { protected: char p; public: char getChar(); }...

Does NakedObjects.NET Integrate well with Editor Templates in MVC 2?

I just recently listened to a podcast on Naked Objects.NET, and one thing came immediately to mind. Does this framework support the use of Editor Templates? Meaning, it would be really great if I could put in an editor template for, say a datetime or something, and have that effect the entire site. Has anyone had any experience using ...

Ambiguous template error adding std::string to uint in Visual C++

I'm getting the following error when I compile the following code on Visual Studio 2008 / Windows SDK 7 const UINT a_uint; UINT result; throw std::runtime_error( std::string("we did ") + a_uint + " and got " + result ); Ironically, I ended up with this result: error C2782: 'std::basic_string<_Elem,_Traits,...

template+floating point non type

Section 4.3 of C++ Templates states 'Not being able to use floating-point literals (and simple constant floating-point expressions) as template arguments has historical reasons.' Similarly, $14.1/7 states - "A non-type template-parameter shall not be declared to have floating point, class, or void type. [ Example...

Templates :Name resolution:Dependent types: -->can any one tell some more examples for this statement?

This is the statement from ISO C++ Standard 14.6.2.1: Dependent types : A type is dependent if it is — a template parameter,#1 — a qualified-id with a nested-name-specifier which contains a class-name that names a dependent type or whose unqualified-id names a dependent type,#2 — a cv-qualified type where the cv-unqualified type is d...

Django admin template with dynamic forms using jquery

I'm developing a questionnaire app. The question model has a "type" field, lets say A and B. The "question" model is set as foreign key to two other models, ModelA and ModelB. Its easy enough to add ModelA(or ModelB) as inlines for questionadmin. But I want to dynamically change the inline fields which are shown on admin page, depending ...

constant references with typedef and templates in c++

I heard the temporary objects can only be assigned to constant references. But this code gives error #include <iostream.h> template<class t> t const& check(){ return t(); //return a temporary object } int main(int argc, char** argv){ const int &resCheck = check<int>(); /* fine */ typedef int& ref; const ref error = check<int...

Simple Handmade PHP Template Engine not working! Help Please

These are the class definitions <?php abstract class MyTemplate { protected $arrayOfSpaces; protected $arrayOfVariables; protected $output; protected abstract function __construct(); function outputHTML(){ echo $output; //Apparently, the problem is HERE. <<<<>>>>> } } class MyTemplateMain extends MyTemplate { ...

Need some advice/suggestions on template syntax.

Heya! I've coded a small php template parser, so templates can be easily parsed, and the variables within the templates are like {variable_name} e.g. <title>{title}</title> Can you suggest me possible if/else statement syntax? I've thought of doing something like: {if {logged_in}: TRUE} You're logged in... {else} You're not... {/if...