templates

Add new templates in Xcode

How to add new templates in Xcode for iPhone application developement? ...

MSSQL Server Management Studio (SSMS) 2005 New Query Template

How do I change a default "New Query" template in SSMS 2005? ...

How do you comment html templates in Php (in a practical way) ?

Is there a simple solution to do the equivalent of Java's comments: <%-- this is a comment inside a template, it does not appear in the output HTML --%> Even if you use short php tags, you still have to wrap the comments with comment syntax, on top of the php tags: <? /* this is a comment of the html template */ ?> I'm considering ...

Template Function under GCC

Duplicate. See this. Can someone tell me why this does not compile under GCC? Both MSVC6, and VS2008 will compile it, with no warnings, even. The code... #include <iostream> #include <vector> #include <ctime> #include <cstdlib> using namespace std; template <typename T> T range(vector<T> &v) { vector<T>::iterator i = v.begin(); ...

Is it possible to get a char* name from a template type in C++

I want to get the string name (const char*) of a template type. Unfortunately I don't have access to RTTI. template< typename T > struct SomeClass { const char* GetClassName() const { return /* magic goes here */; } } So SomeClass<int> sc; sc.GetClassName(); // returns "int" Is this possible? I can't find a way and am about...

Explain about linkages(external/internal) in c++?

Explain about linkages(external/internal) in c++? How does linkage differ for a function,constant,inline function,template function ,class and template class ...

Most important things about C++ templates… lesson learned

What are most important things you know about templates: hidden features, common mistakes, best and most useful practices, tips...common mistakes/oversight/assumptions I am starting to implement most of my library/API using templates and would like to collect most common patterns, tips, etc., found in practice. Let me formalize the que...

Modify VB property template in VS2008

In VS2008 (VB.NET) when you type Public Property X As SomeType and press enter, VS auto-generates the rest of that property definition for you. I would like to be able to customize what VS generates. Any thoughts on how to go about that? VS must have a template for it somewhere, eh? Thanks. ...

C++ "smart" predicate for stl algorithm.

I need to designe predicate for stl algorithms such as find_if, count_if. namespace lib { struct Finder { Finder( const std::string& name ): name_( name ) { } template< typename TElement > bool operator( const TElement& element ) { return element.isPresent(...

Template function passed to shared library (c++)

Bit of a thought experiment... Ingredient 1: A class in a (precompiled) shared library that has a function that takes a pointer to an object derived from ostream: void ClassName::SetDefaultStream(std::ostream *stream) Ingredient 2: My own class deriving from std::ostream, with some generic templated stream operator: class MyStream :...

Template or abstract base class?

If I want to make a class adaptable, and make it possible to select different algorithms from the outside -- what is the best implementation in C++? I see mainly two possibilities: Use an abstract base class and pass concrete object in Use a template Here is a little example, implemented in the various versions: Version 1: Abstract...

Accessing inherited variable from templated parent class

Consider the following code: template<class T> class Foo { public: Foo() { a = 1; } protected: int a; }; template<class T> class Bar : public Foo<T> { public: Bar() { b = 4; }; int Perna(int u); protected: int b; }; template<class T> int Bar<T>::Perna(int u) { int c = Foo<T>::a * 4; // This works return (a + b) * u...

Creating Site Templates from MOSS publishing sites

I know that creating a site template from a MOSS publishing site is not currently supported by Microsoft. Can anyone tell me if creating a basic site, then turning on the publishing feature, then creating a site template is supported - I would guess not as it's probably the same as creating a publishing portal? ...

Using static variable along with templates

I have a template class defined in a header file like this. Here I have defined a static variable as well: #ifndef TEST1_H_ #define TEST1_H_ void f1(); static int count; template <class T> class MyClass { public: void f() { ++count; } }; #endif And I have defined main() function in a different cpp file like thi...

Nameless enums in templates

Hi, Alot templated code looks like this: template <typename T> class foo { enum { value = <some expr with T> }; }; An example can be seen here in the prime check program and I've seen it in a Factorial implementation once too. My question is why use a nameless enum? Is there a particular reason to this? A static const int could ...

Select template argument at runtime in C++

Suppose I have a set of functions and classes which are templated to use single (float) or double precision. Of course I could write just two pieces of bootstrap code, or mess with macros. But can I just switch template argument at runtime? ...

Where to put the "template" and "typename" on dependent names

I implemented a "discriminated union" capable of holding C++ types, even if they have destructors etc. I implemented this as a Russian doll; i.e. Union<T1, T2, T3> derives from unionNode<T1, <UnionNode<T2, UnionNode<T3, void> > > and UnionNode<T, Tail> derives from Tail. The specialization UnionNode<T, void> holds a void* which contains ...

How can I have an ASP.NET templated composite control?

I am trying to add a template to a simplified composite control containing a Label and a TextBox. I want my mark up to look something like this: <test:FormItem ID="fi" runat="server" Title="MyTitle" Text="My Text!"> <TestTemplate> <i> <%# Container.Title) %></i> <br /> <%# Container.Text %> <...

Best Python templating library to facilitate code generation.

It's been awhile since I've done something like this and it seems that everyone and their grandmother has created a templating library for python, from Mako, Cheetah, Genshi, etc... Instead of me spending the next day (or year) reading about them all, any suggestions for templating engines that I should look into in more detail? Thanks...

Definitive pattern for implementing templated data-bound controls in ASP.NET

I am working on a project at the moment where we are building templated data-bound controls (TDBC) for ASP.NET. The problem is it appears that nobody has really worked out the definitive pattern for how to do this - there are 3 or 4 different 'styles'. Not only that but many of the controls are giving the "cannot use databinding when ...