templates

Class templates and template class

Is there a difference between a class template and template class. If so what is it? ...

How2 display Image from DB in datagrid?

Hope it's not yet been answered, but I've googled for quite a long time, and I've not been able to get it working. In brief, I've a SL4 page with a DataGrid filled accordingly to parameters passed from the previous page, so I fill the context in code, with a "RIA" query (w/parameters as well). So far, so good. I get the XAML declared col...

C++ template overloading - wrong function called

template<typename T> T* Push(T* ptr); template<typename T> T* Push(T& ref); template<typename T, typename T1> T* Push(T1&& ref); I have int i = 0; Push<int>(i); But the compiler calls it ambiguous. How is that ambiguous? The second function is clearly the preferred match since it's more specia...

Error in creating template class

I found this vector template class implementation, but it doesn't compile on XCode. Header file: // File: myvector.h #ifndef _myvector_h #define _myvector_h template <typename ElemType> class MyVector { public: MyVector(); ~MyVector(); int size(); void add(ElemType s); ElemType getAt(int index); private: ElemType *arr; int numUs...

HTML website templates for programmer's website

Where could I find HTML website templates geared toward a programmer's website? I have looked on Google but couldn't find templates specifically for a programmer's website. EDIT: To clairify, I want this as information about me, my projects, a blog, and some other stuff. ...

Passing a template func. as a func. ptr to an overloaded func. - is there a way to compile this code?

Just a general c++ curiosity: This code below shouldn't compile because it's impossible to know which to instantiate: temp(const int&) or temp(const string&) when calling func(temp) - this part i know. What i would like to know is if there is anything i can do to the line marked PASSINGLINE to get the compiler to deduce that i want ...

Umbraco template issues

Hi fellow Umbraco users, I'm currently building my first umbraco website and since I'm completely new to umbraco I've already ran into a problem which I'm sure is pretty straight-forward to do. That said, I'm by no means a beginner when it comes to building sites that run on a (open source) CMS as I've been using Joomla! since it was c...

How can I easily pass all the variables from a template to a partial in Symfony with output escaping on?

It there an easy way to pass all the variables a template file has access to onto a partial when I have output escaping on? I tend to create a template file, then refactor things into a partial at some point and it would seem that there would be an easy way to just pass all the same variables from the template to the partial and be done...

C++ Iterators and inheritance

Have a quick question about what would be the best way to implement iterators in the following: Say I have a templated base class 'List' and two subclasses "ListImpl1" and "ListImpl2". The basic requirement of the base class is to be iterable i.e. I can do: for(List<T>::iterator it = list->begin(); it != list->end(); it++){ ... } ...

Django-like templates system for Java?

I'm looking for the templates engine for Java with syntax like in Django templates or Twig (PHP). Is it exists? Update: The target is to have same templates files for different languages. File index.tpl {{head}} {{ var|escape }} {{body}} can be rendered from python (Django) code as well as from PHP, using Twig. I'm looking for Java ...

C++ enum casting and templates

I get the following error with VS2008: Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast) When casting a down casting a ClassA to ClassA_1 and ClassA_1 is a templated class that received an enum for parameter such as: THIS IS AN EDIT OF MY QUESTION WHICH RE-USE AN ANSWER BELOW BU...

Providing *implicit* conversion operator for template specialization

I have a templated sparse_vector<T> class, and I am also using Boost UBLAS. How would I provide implicit conversions between sparse_vector<double> and boost::numeric::ublas::compressed_vector<double>? I would also like to provide similar conversions between std::vector<double> and boost::numeric::ublas::vector<double>. (I am using gcc...

Liquid templates - accessing members by name

I'm using Jekyll to create a new blog. It uses Liquid underneath. Jekyll defines certain "variables": site, content, page, post and paginator. These "variables" have several "members". For instance, post.date will return the date of a post, while post.url will return its url. My question is: can I access a variable's member using anoth...

template function error..

Hi there, I have function which takes in an parameter of a class called "Triple", and am returning the averge of 3 values of type float. template <typename ElemT> float average(Triple ElemT<float> &arg){ float pos1 = arg.getElem(1); float pos2 = arg.getElem(2); float pos3 = arg.getElem(3); return ( (pos1+pos2+po3) /3 );...

C++ rvalue temporaries in template

hello. Can you please explain me the difference between mechanism of the following: int function(); template<class T> void function2(T&); void main() { function2(function()); // compiler error, instantiated as int & const int& v = function(); function2(v); // okay, instantiated as const int& } is my reasoning correct w...

ASP.Net Templated Server Controls difference between UpdatePanel and other controls

Hi, Using the advise given on this post... http://stackoverflow.com/questions/2908260/creating-an-asp-net-templated-server-control ... I was able to create a nice templated server control. However, what I noticed is that on some templated controls such as the ASP.Net UpdatePanel you dont need to use FindControl to find the actual co...

C++ typedef for partial templates

Hi, i need to do a typedef like this. template< class A, class B, class C > class X { }; template< class B, class C > typedef X< std::vector<B>, B, C > Y; I just found that it is not supported in C++. Can someone advise me on how to achieve the same through alternative means? Thanks, Gokul. ...

word Application.AddIns.Add throws 'Word cannot open this document template'

Hi, I have a template document with a simple macro to insert a file into a document. When i try to load this template file using Application.Addins.Add i am getting an error saying 'Word cannot open this document template'. wordApplication.AddIns.Add( %template file path%, ref trueObj ); This works fine on some machines. Also is the...

Custom XCode Template?

I would like to make my own iPhone Application Templates in XCode, based on a modified project from the Apple templates. For example, I would like to take a View Based project, add an Image View and save that project as a template. Really, this is just an example. Is this possible? How so? ...

C++ template instantiation with identity argument

hello. I have ran into yet another problem I do not understand. The following does not instantiate (argument instantiation fails), why? template<class E> void operator[](typename boost::mpl::identity<E>::type e) const; thank you for your help ...