templates

Variadic templates

Hi all, I have seen a lot of links introduced the variadic templates. But I have never seen one compilable example that demonstrates this approach? Could someone provides me some links in which such compilable examples can be found? regards Sami ...

Declaring an instance of an explicit specializtion of a template within a regular class

I can't get this to compile at all. I may not be possible but I don't know why it should not be. class A { template <typename T> class B { int test() { return 0; } }; //template <> class B<int>; <-with this, namepace error B<int> myB_; }; template <> class A::B<int> { int test() { return 1; } }; As it appears ...

Do this in C# code instead of template XAML

Is there a way to make column of cells in a Silverlight datagrid be readonly in editmode with C# code instead of setting up a entire datagrid as a template in a resource file? UPDATE Found an example piece of code - http://forums.silverlight.net/forums/p/17483/58189.aspx In the response by slhungry midway into the thread. He has examp...

Running T4 templates from other T4 template

Hi there, does anyone know if it's possible to run T4 template file from another T4 template, inside VS2010 Thank ...

Gridview with different template per datasource

I have a gridview that I would like to be able to bind to several sqldatasources, but still use template fields. Each datasource is different and would have different columns so I'm not sure how to go about this. Is it possible to define a set of template fields or overlying template per datasource? ...

Custom WPF DatePickerTextBox Template Help

I am trying to use a custom textbox in the DatePicker control, but I can't get the date to bind from the popup calendar to the TextBox. I don't want to have to style the entire DatePicker unless I have to, and the DatePickerTextBox has its own control, so there must be a way to only alter it. The code below is what I have as a start: <S...

Instantiating template with a variably modified type

Hi, One of my class' member method take as an argument of enumeration type: it produces different side effects for different enum. I was wondering whether it's possible to use template as a lookup table, two possible solutions came up to my mind, but none of them seems to work: //// 1 //// class A { public: enum AEnum : uint...

Django template ifequal - request GET and object id

Why is this not the same?? {% ifequal gender.id request.GET.gender %} {{gender.name}} {% endifequal %} gender.id = 1 request.GET.gender = 1 Please help, I think it's simple :) ...

Two really similar classes in C++ with only one different method: how to implement?

Hi all, I have two classes that are almost identical, besides one method. The classes have the same data part and all the member functions but one: class A { private: double data; public: double calc(){ return data*data; } double especific(){ return 2.0*data; } } and the second class is identical, besides the es...

address of c++ template function

Why does this fail to compile? (g++-4.5) template < typename U > static void h () { } int main () { auto p = &h<int>; // error: p has incomplete type } EDIT: Here is a work-around: template < typename U > static void h () { } int main () { typedef decltype (&h<int>) D; D p = &h<int>; // works } ...

Reuse Variable across Wordpress Templates

Hi, I query some information in my wordpress blog's header. How can I reuse the variable say in the sidebar of the blog? If I try something like this in the sidebar, the output stays blank: <?php if(isset($my_header_variable)) echo $my_header_variable; ?> ...

Does python have a safe, user editable script markup for templates like RoR's liquid?

I'm looking for a templating language, that end users can safely edit to customize their html/theme of a web application. Something to how http://www.liquidmarkup.org/ works. ...

Why this c++ template code can't be compiled?

This is a code sample copied from chapter 17 as bellow. When I compile it with Visual Studio 2008, it keeps this error: warning C4346: 'HashMap::mapped_type' : dependent name is not a type 1> prefix with 'typename' to indicate a type Does anyone has any idea about this? Thanks in advance! #include <vector> #include <map> using...

JSP Template- can't load TLD entry for template:insert

I'm new to JSP, using Eclipse, and am trying to just get started with templates. I've imported template.tld into WebContent/WEB-INF/tlds. Guide: http://www.javaworld.com/jw-09-2000/jw-0915-jspweb.html When I run the test.jsp file, I get this error: org.apache.jasper.JasperException: /test.jsp(3,0) Unable to load tag handler class "tag...

Problem setting Foreground with Visual State Manager

I have a WPF application, and I am attempting to style a TextBox using the .Net v4 Visual State Manager. Specifically, I am attempting to set the colors of the Foreground and Background for the MouseOver state. What is happening is that, while the background and border are changing perfectly, the foreground is not. If the brushes that...

Implementing a map_keys_iterator by derivation: a single compiler error

Hi everyone. I was working again with C++ during the weekend and came to notice something that I'm not sure where does it come from. Following the advice in this thread, I decided to implement a map_keys_iterator and map_values_iterator. I took the -- I think -- recommended-against approach of deriving a class from std::map<K,V>::itera...

Misscreation of my template class causes errors with SOCKET, why?

Hey... I created a class which holds data of type and returns an vector on request. But somehow the following error occurs: error C2259: 'CAcceptor' : cannot instantiate abstract class due to following members: 'void CDataAndEvent<C>::InitQueue(void)' : is abstract with [ C=SOCKET ...

Handmade auto template (without using C++0x)

How can be realized the auto keyword functionality without using c++0x standard? for(std::deque<std::pair<int, int> >::iterator it = points.begin(); it != points.end(); ++it) { ... } Maybe such class: class AUTO { public: template <typename T1> AUTO(T1); template <typename T2> operator T2(); }; With such usage: ...

Resharper template macro for method return type

I can't seem to find a way to insert the method return type in a Resharper 5 macro. Can this be done? For example, I have the following template: Contract.Ensure(Contract.Result<$RESULTTYPE$>() != null); I would like $REUSLTTYPE$ to be automatically filled with the data type of the current method, but I can't find a macro that woul...

void return value from a function used as input to a templated function is seen as a parameter.

Say you have some target class with some methods on it: class Subject { public: void voidReturn() { std::cout<<__FUNCTION__<<std::endl; } int intReturn() { std::cout<<__FUNCTION__<<std::endl; return 137; } }; And a Value class (similar in concept to Boost.Any): struct Value { Value() {} Value( Value const & orig ) {} temp...