templates

C++ template type deduction problem

motivation: I would like to create a utility class so that instead of having to write: if( someVal == val1 || someVal == val2 || someVal == val3 ) I could instead write: if( is(someVal).in(val1, val2, val3) ) which is much closer to the mathematical 'a is an element of (b,c,d)' and also would save on a lot of typing when the var...

Specifying Struts templates source

Say I'm using a form with a text-field. <@s.form action="login"> <@s.textfield label="E-mail" name="email"/> <@s.submit value="send"/> How can I specify that the text-form should be generated by a custom template (text_login.ftl) rather than the standard text.ftl? ...

Problems with passing an anonymous temporary function-object to a templatized constructor.

I am trying to attach a function-object to be called on destruction of a templatized class. However, I can not seem to be able to pass the function-object as a temporary. The warning I get is (if the comment the line xi.data = 5;): warning C4930: 'X<T> xi2(writer (__cdecl *)(void))': prototyped function not called (was a variab...

Add a grouping template to a ASP:Repeater that displays after any header template

I have sub classed a asp repeater similar to A Grouping Repeater All works fine apart from if I also have a <HeaderTemplate> </HeaderTemplate> The grouping template is rendered before the header template. I would really like to either be able to choose the order in which the templates are rendered or just have the <GroupTemplate> Rende...

Vignette collab template language name and reference

What is the name of the programming language enclosed by ISPECT tags used in Vignette Collaboration ? Is there any refence for that beast ? thank you ! ...

Return pointer to nested inner class from generic outer class

I'm new to C++, so bear with me. I have a generic class called A. A has a nested class called B. A contains a method called getB(), which is supposed to return a new instance of B. However, I can't get my code to compile. Here's what it looks like:#include A.h template <class E> class A { public: class B { public: ...

Inheritance of templates in WPF

I'm trying to make sure that every child of a given element (MPF.MWindow) gets custom templates. For instance, the button should get the template defined in resMButton.xaml. As of now I'm using the following code on: (resMWindow.xaml) <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...

session_start and Dreamweaver templates

session_start() should be the first line of web page. Dreamweaver's php templates should be used inside the HTML tag (so, obviously this is not the first line). What to do? ...

Templates, and C++ operator for logic: B contained by set A

In C++, I'm looking to implement an operator for selecting items in a list (of type B) based upon B being contained entirely within A. In the book "the logical design of digital computers" by Montgomery Phister jr (published 1958), p54, it says: F11 = A + ~B has two interesting and useful associations, neither of them having much to do...

Sub-classing templated class without implementing pure virtual method

I have the following class definition: template<typename QueueItemT> class QueueBC { protected: QueueBC() {} virtual ~QueueBC() {} private: virtual IItemBuf* constructItem(const QueueItemT& item) = 0; } I created the following sub-class: class MyQueue : public QueueBC<MyItemT> { public: MyQueue() {} virtual...

C++ template meta-programming, number of member variables?

hello Is it possible in C++ to determine number of variables/fields in the generic class? for example // suppose I need metaclass number_members determines number of members struct example { int i, j; }; assert(number_members<example>::value==2); I looked through mpl but could not find implementation. thanks. ...

Is there a way to use template specialization to separate new from new[]?

I have an auto pointer class and in the constructor I am passing in a pointer. I want to be able to separate new from new[] in the constructor so that I can properly call delete or delete[] in the destructor. Can this be done through template specialization? I don't want to have to pass in a boolean in the constructor. template <typ...

template specialization of a auto_ptr<T>

Maybe I'm overcomplicating things, but then again, I do sort of like clean interfaces. Let's say I want a specialization of auto_ptr for an fstream - I want a default fstream for the generic case, but allow a replacement pointer? template <> class auto_ptr<fstream> { static fstream myfStream; fstream* ptr; public: ...

Dynamics AX 2009 Visual Studio Template Files

Where online can I download the Visual Studio template files for Microsoft Dynamics AX 2009? ...

How would I best make this SEO_able?

I have a search engine that searches albums. For each music album, I have a page. So, the work flow goes like this: People search for music titles The search engine displays a list of albums. People click on an album to go to a details page. I want google to index my front page and the details page. I want the details page to be hig...

C++ allocators, specifically passing constructor arguments to objects allocated with boost::interprocess::cached_adaptive_pool

This is an embarrassing question, but even the well-written documentation provided with boost.interprocess hasn't been enough for me to figure out how to do this. What I have is a cached_adaptive_pool allocator instance, and I want to use it to construct an object, passing along constructor parameters: struct Test { Test(float argume...

How do you post content to a specific template position?

I purchased a template / theme from RocketTheme, but I can't figure out how to add content at a specific position. The templates have "module positions" that collapse. I'd like to add some content at one of the module positions. If I add articles, they seem to go into "mainbody". But I'd like to have content in other areas of the templ...

simplifying templates

I have a bunch of templates that are used for rpc and was wondering if there is a way to simplify them down as it repeats it self allot. I know varags for templates is coming in the next standard but can you do default values for templates? Also is there a way to handle void returning functions as normal functions? Atm i have to separat...

Is there any reasonable use of a function returning an anonymous struct?

Here is an (artificial) example of using a function that returns an anonymous struct and does "something" useful: #include <iostream> template<typename T> T* func( T* t, float a, float b ) { if(!t) { t = new T; t->a = a; t->b = b; } else { t->a += a; t->b += b; } retu...

C++ Expression Templates

Hi, I currently use C for numerical computations. I've heard that using C++ Expression Templates is better for scientific computing. What are C++ Expression Templates in simple terms? Are there books around that discuss numerical methods/computations using C++ Expression Templates? In what way, C++ Expression Templates are better than...