templates

What do these linking errors mean? (C++) (MSVC++)

EDIT: When I merge link_def.cpp with link_dec.h, I only get the first error, not the second two. I got these linker errors when I tried to compile some code: CODE: #include"list_dec.h" #include"catch.h" int main() { list<int, 100> L1; try { L1.return_current(); } catch(err) { return -1; } ret...

Nesting C++ Template Definitions

I'm abusing C++ templates a little and I'm having trouble figuring something out. Let's say I have two types that really should be inherited from a base type, but for speed reasons, I can't afford to have the virtual function overhead (I've benchmarked it, and virtual calls ruin things for me!). First, here are the two classes I have ...

What is the correct way to represent template classes with UML?

The title says it all... ...

How do I connect to events when using templates?

I'm new to Silverlight/XAML/C# and havn't figured out all the concepts yet. I'm using the Accordion control together with some templates, the XAML looks like this: <layoutToolkit:Accordion x:Name="MatchesAccordion" SelectionMode="ZeroOrMore" Width="Auto" SizeChanged="MatchesAccordion_SizeChanged"> <layoutToolkit:Accordion.HeaderTemp...

Accessing a template base classes function pointer type

I have a class that I've been provided that I really don't want to change, but I do want to extend. I'm a pattern and template newbie experimenting with a Decorator pattern applied to a template class. Template class contains a pointer-to-member (if I understand the semantics correctly) in yet another class. The pointer-to-member is t...

Restrict the selection a WPF TreeView With Icons to Text only

I have a simple WPF TreeView with icons <TreeView Name="TreeViewThings" ItemsSource="{Binding}"> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type local:Thing}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal" Margin="2"> <Imag...

Can't call base class method even though I have a pointer to it (Decorator)?

I have a template class that I've subclassed with a pointer to it (Decorator pattern). I added a getBase() call to return the pointer to the base class for any further subclasses. However, when I use that getBase() and call the base classes only method, I get a linker error that it can't find the symbol for that method in the interveni...

generic code snippets / templates in eclipse

hi, i'm currently evaluating eclipse after using textmate for all my development for many years. what i miss in eclipse and what i can't find any solution for are some kind of generic templates: i'm using PDT for my javascript and php development, and it supports code-templates. however , in my projects i'm writing large amounts of she...

Polymorphic or generic approach is better? C#

I have two classes and an interface like interface IVehicle { void Drive(); } class Benz :IVehicle { public void Drive() { Console.WriteLine("WOW! driving benz"); } } class Ferrari : IVehicle { public void Drive() { Console.WriteLine("WOW! driving ferrari"); } } I got a Driver class which ...

Templates and Syntax

Hello all :) Working on an algorithm to look at a STL container of STL strings (or other strings, making it general) Basically it loops through something like a std::list and returns the length of the longest beginning in common. It's for processing lists of files, like this: C:\Windows\System32\Stuff.exe C:\Windows\Things\InHere.txt...

fail using hash_map<vector<int>,string>, why ?

I have implemented this code, but fail at compilation (VC2008 Express Ed.) : Now all code is here. #include <stdio.h> #include <vector> #include <string> #include <hash_map> using namespace std; using namespace stdext; typedef vector type_key; int main(int argc, char* argv[]) { type_key key; hash_map<type_key, string> map_s...

C++ templates that accept only certain types

In Java you can define generic class that accept only types that extends class of your choice, eg: public class ObservableList<T extends List> { ... } This is done using "extends" keyword. Is there some simple equivalent to this keyword in C++? ...

what templating engine options are there for PHP?

I wonder what options there are for templating in PHP? If the templating code can be very similar to PHP, it'd be best. ...

Create own template for FormView's Auto Format

Is it possible to create and add own template into FormView's Auto Format selection? I had a standard design which I would like to apply across the board to all my form view, instead of copy-and-paste into individual one then manually editing it. I'm referring to the auto generated ItemTemplate, EditItemTemplate, InsertItemTemplate ...

Templates with identical names and Smarty

I have a small problem with Smarty... I have two different template files in two different directories that happen to have the same name. Unfortunately Smarty gets them confused. It uses the last one to be updated to create a compiled file in its /templates_c folder, which it then uses to display the page. This means that both files en...

XSLT template overriding

Hi Everyone, I have a small question regarding XSLT template overriding. For this segment of my XML: <record> <medication> <medicine> <name>penicillin G</name> <strength>500 mg</strength> </medicine> </medication> </record> In my XSLT sheet, I have two templates in the following order: <xsl:template match=...

Model formsets and Date fields.

I have a model formset on a model with a couple of date fields - which again is a DateTimeField in the model. But when it displays in the template, it is shown as a text field. How can I show it as a drop down box ? WFormSet = inlineformset_factory(UserProfile, W, can_delete=False,exclude=[<list of fields to be excluded>], extra=3) T...

How do I reduce "uses" boilerplate for new forms?

Every time I add a new form to my project, it drops a big glop of boilerplate in the uses clause. uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; Seriously, who uses the Variants unit on anything resembling a regular basis? I generally end up removing Windows, Messages, Variants, Graphics ...

Rendering JSON objects using a Django template after an Ajax call..

I've been trying to understand what's the optimal way to do Ajax in Django. By reading stuff here and there I gathered that the common process is: formulate your Ajax call using some JavaScript library (e.g., jQuery), set up a URL pattern in Django that catches the call and passes it to a view function in the Python view function retr...

What are C++ non-template members as used in the Barton-Nackman trick?

From wikipedia: // A class template to express an equality comparison interface. template<typename T> class equal_comparable { friend bool operator==(T const &a, T const &b) { return a.equal_to(b); } friend bool operator!=(T const &a, T const &b) { return !a.equal_to(b); } }; class value_type // Class value_type wants to have ...