templates

A C++ syntax question involving non trivial templating and friend declaration

Hi, The following code should be self explanatory. I have two questions regarding the used syntax (which is the syntax that must be used). I'll be forever grateful if you could provide me with answers for these presented questions. template <typename T> struct A { template <typename S> void f (const A<S> &s); template <typ...

Desiging a template-based CMS Question

I need to develop a template-based content management system. I don't care about what operating system will be used to run the CMS -- as my server is dedicated. It can be Windows, Linux, whatever. But, I need a recommendation for a platform/framework for this purpose. The CMS should be fast, and should support friendly urls. Here's an e...

template error is getting

// template Signal<float>; template Signal<bit_t>; template Signal<byte_t>; template Signal< std::complex<float> >; template Signal< int >; // ============= error at signal_T.cpp:437: error: expected unqualified-id before â;â token signal_T.cpp:438: error: expected unqualified-id before â;â token signal_T.cpp:439: error: expected u...

Unique Numerical ID for a Templated Class using Function Address

So, this question has been asked before, but I wanted a question with some of those key words in the title. The issue is simple: How can I have a templated class, such that for each instance of the template - but not each instance of the class - there is a unique, numerical identifier? That is, a way to differentiate: foo<int> f1; foo...

C++ My first template ever

Ok, which is the best to avoid ambiguity here? template <class T> inline void swap(T &a, T &b) { T c; c = a; a = b; b = c; } /* blah blah blah (inside of a function:) */ for (itv = vals.begin(); itv != vals.end(); ++itv) { if (at < (*itv)) { swap(at, (*itv)); } if (at % (*itv) == 0) atadd = false; } /* blah blah blah */ Ca...

How to change WPF Listbox/ListBoxItem DataTemplate for selected item WITHOUT affecting style & theming?

This question is very similar to Change WPF DataTemplate..., which I have read and implemented. It worked beautifully at first, but I ran into a problem with it. That problem is that, when using themes in your application such as those in the WPF Futures project (e.g. Expression Dark), the ListBoxItems all revert back to the default WPF...

django template exceptions handling

All, There is a template say x.html its contes are <form action ="/lookinto/a"> <p >name:</td><td> <input type="text" id=name" name="name"></input></p></tr> <tr><td> <p >Section:</td><td> <input type="text" id="section" name="section"></input></p></td></tr> </form> My question is that when handling,/lookinto/a if i have an exception...

How do I generate XML from XMLBuilder using a .xml.builder file?

I have started using xml builder templates for most of my model. I need to find a generic way to build XML outside of a render which uses the .xml.builder template instead of the generic .to_xml method provided in the model I gather that I will have to override the default to_xml (or add a to_my_xml), but I am unable to see how to get X...

Complex email templates

I saw a thread on email templates, with maildefinition class being to limited, bitethebullet.co.uk xml based for simple field/list replacement, and nvelocity and stringtemplate for more complex tasks. Is there some example code out there for nvelocity and/or stringtemplate (c#) used for email templates? mike ...

Multiple views loaded into a template

Hay guys, in PHP when i want to load a differnet page (render, with all variables outputting) i would use include 'mypage.php' This would load the page up and render the output. How do i do something like this in Django? My problem is that i have a "quick list" which lists a bunch of popular items. I want this list to appear on every...

MVC Folder Structure for Project with Multiple Themes/Skin

I'm working on a project that has multiple theme/skin and is extensible via plugins. As it stands right now my folder is structured as such. vc/ controller/ home/ view/ classic/ home/ spring/ home/ plugin/ feedReader/ view/ locale/ template/ header.ht...

Getting data from classes outside it's construction.

Maby the title is confusing , but i try to explain here what i'm trying to do. I'm working on the oscommerce 3 project inside another cms. Above my expectations i succeed verry well. But there's one problem left for me , i cant get the generated dynamic titles from oscommerce into the cms. Oscommerce uses a template class and combine ...

C++ Compiler error with CRTP

I have the following class hierarchy: template <typename T> class base { public: void f() {} }; class class_a : public base<class_a> {}; class class_b : public base<class_b>, public class_a { using base<class_b>::f; }; int main() { class_b b; b.f(); return 0; } Comeu and Intel C++ v11 claim all is...

C++: Why can't I use float value as a template parameter?

When I try to use float as a template param, the compiler cries for this code, while int works fine. Is it that I cannot use float as a template parameter? #include<iostream> using namespace std; template <class T, T defaultValue> class GenericClass { private: T value; public: GenericClass() { value = defaultValue; ...

Opaque object for template in another namespace...

Hi, I know how to do an opaque object in C++ as following: // my_class.hpp class opaque_object; class my_class { my_class(); ~my_class(); opaque_object *m_opaque_object; }; // my_class.cpp #include <my_class.hpp> class opaque_object { // ... }; my_class::my_class() { m_opaque_object = new opaque_object(); } my_class::~...

django templates, find string replace with other string

Hay, I'm writing some templates but i want to convert " " into "_" within a string. I want to convert {{ user.name }} Which outputs "My Name" to "My_Name" how do i do this? Thanks ...

Implications of template declaration & definition

From what I understand template classes and template functions (for the most part) must be declared and defined in the same header file. With that said: Are there any other ways to achieve separate compilation of template files other than using particular compilers? If yes, what are those? What, if any, are the drawbacks of having the ...

Template class and class properties that are also templates

I'm having trouble compiling the following header. It's my first experience with templates and I guess I'm getting something wrong. The compilers point errors at vector<vector<T>> data_; and the operator overloading function. I would like the data_ vector to have the same type as the OptBaseMatrix object but I'm not sure how to do it... ...

Recursive block T4 template

Hi Everybody, I have a funtion named IterateThroughChildren() and I want to write the code to emit the code from inside of that function. Normally the code block is included inside <# #> and custom functions are included inside <#+ #>, we emit our code inside <#= #> block. What if I want to recursively execute the above mentioned funct...

Django: How do I get an array from a QueryDict in a template?

hi, I've got the following QueryDict object in my request.session. <QueryDict: {u'category': [u'44', u'46'], u'cityID': [u'null'], u'countryCode': [u''], u'mapCenterLng': [u'2.291300800000009'], u'mapZoom': [u'12'], u'mapCenterLat': [u'47.10983460000001'], u'price_range': [u''], u'textbox': [u'']}> In a template try to get the catego...