templates

Copy comments with T4 template

I'm generating a class from an interface using T4 templates, and I want to be able to copy xml-comments from the interface to the class methods. Is it possible and if yes, how? In my template I am just taking the interface methods and copying them like this: foreach(var m in typeof(IFrontEndService).GetMethods()) { <#= "Some out...

iphone compiler inherited templated base classes with passed through type not being expanded in time (just look)

Try this out: template <typename T> class Base { public: int someBaseMember; }; template <typename T> class Test: public Base<T> { public: void testFunc() { someBaseMember = 0; } }; In vc++ and the psp compiler (and any other compiler ...

Change the layout of a TreeView to looks like multiple ListBox

Hi there, I'm trying to change the layout of a databound treeview from this: To this: And of course selection must works properly: Do you have any ideas about how to do that. I've been trying to change the template but I can't find out a way to have this behavior. Maybe a component already exists... Thanks for your help ! ...

What is LINQ to SQL template? What is the advantage of it?

What is LINQ to SQL template? What is the advantages of it? ...

How would I import a function template using PInvoke?

In my C# code, I need to call a function from a C++ Dll that I wrote.The function is generic. So , should I just import it like this: [DllImport("myDll.dll")] private static extern TypeName functionName<TypeName>( int arg1, int arg2 ); Is this correct syntax? Thanks. ...

Is it a problem to use the same IDs in different asp.net FormView templates?

I understand that only one FormView template is rendered at any given time, so is it ever a problem to reuse child control IDs? For example, the insert and edit templates are identical in this FormView, each has a TextBox in which a user may enter their name. Would it be a problem (or a bad idea) to give both text boxes the ID "NameTex...

Why does .NET dislike this C++/CLI template function?

In a plain vanilla WinForms app (C++/CLI, set to /clr), I have the following template function, flagged as "unmanaged": #pragma managed(push, off) #include <string> template< class c > const c& test_alloc() { static c test_alloc; return test_alloc; } #pragma managed(pop) Then in main, I use it before Application::Run(): test_al...

How to make an inner div push the outer div down.

Suppose I have an div. Inside this div, I have two divs floating left, right next to each other, I believe. The left div is for a picture. For some reason, when the picture is too tall, it doesn't push the outer div to fit the picture. Instead, the picture just keeps going on its own and goes "beyond" the outer div's bottom border. H...

Suppose I have a list of 500 thumbnails followed by the title. How do I load the images as the user scrolls down? (JQuery)

In mobile, the internet is slow. If I have a list of 500 images, this is going to take forever to load. I'd like to load the title of the image in a list, but as the user scrolls down, I want to start loading/downloading the <img> tag. How do I use Javascript/Jquery to do this? ...

IPhone compilation of ported code problems: sub class of template parameter base class inaccessible

check this out: template <class T> class Test: public T { public: void TestFunc() { T::SubClass bob; } }; this fails when compiling for iPhone (expected ';' before 'bob'). works on other platforms this is a simplified example of what we are actually trying to do, which is inherit from an std::map<> and inside tha...

i want to put a variable in a aspx so when publishing it transform to actual date...

I want to put a variable in a aspx so when publishing it transform to actual date... I mean I want to change Actual date: 23/12/10 for Actual date: $date and when it compiles it gets rendered ...

C++ metaprogramming with templates versus inlining.

Is it worth to write code like the following to copy array elements: #include <iostream> using namespace std; template<int START, int N> struct Repeat { static void copy (int * x, int * y) { x[START+N-1] = y[START+N-1]; Repeat<START, N-1>::copy(x,y); } }; template<int START> struct Repeat<START, 0> { static void copy ...

Templated operator[]... possible? Useful?

Could you have: template <class T> const T &operator[] (unsigned int x) My thinking was if you have a map<string,string> it would be nice to have a wrapper class which lets you do: obj["IntVal"]="12"; obj["StringVal"]="Test"; int i = obj["IntVal"]; How close to this can we actually get in C++? Is it worth the pain? ...

How to unroll a short loop in C++ using templates?

I wonder how to get something like this 1 write copy(a,b,2,3) 2 and then get, a[2]=b[2]; a[3]=b[3]; a[4]=b[4]; I know that C #defines can't be used recursively to get that effect, so I suppose that template meta-programming is in place. I know there is a boost library for that, but I only want that "simple" trick, and boost is ...

Find out the number of digits of min/max values of an integral type at compile time

Is there a way to find out the number of digits of min/max values of an integral type at compile time so that it's suitable to be placed as a template parameter? Ideally, there will be an existing solution in, for example, Boost MPL. Failing that I'm looking for some pointers for a hand-coded solution. ...

Why does this random, unexpected horizontal line appear in IE7?

I am using YUI's datatable (http://developer.yahoo.com/yui/datatable/) to make a table. But notice something very wrong...sometimes, there is a line that appears on top of a result, only in IE7. This may or may not be related to the YUI plugin. Does anyone know how to fix this? Thanks.! Edit: For some reason, it only appears at that p...

Magic arguments in function templates...

In the following code #include<iostream> template<typename T,size_t N> void cal_size(T (&a)[N]) { std::cout<<"size of array is: "<<N<<std::endl; } int main() { int a[]={1,2,3,4,5,6}; int b[]={1}; cal_size(a); cal_size(b); } As expected the size of both the arrays gets printed. But how does N automa...

In IE8, why is it that when I point a link to Twitter.com, it pops up a "download open/save as..." dialog?

<a href="http://twitter.com/theusername"&gt;Click&lt;/a&gt; For some reason, it pops up the download instead of going to the page. Edit: When I close IE8 and open it again, it works again. Then, the 2nd time, it won't work. I have to close and open IE8 each time for it to work. ...

Why element.getElementsByTagName() can't select the node dynamicly added?

final Button sendButton = new Button("Send"); sendButton.getElement().setId("button"); RootPanel.get().getElement().appendChild(sendButton.getElement()); NodeList buttonElement = Document.get().getElementsByTagName("button"); if(buttonElement != null && buttonElement.getLength() > 0){ buttonElement.getItem(0).setNodeValue("Changed"); }e...

Error yaml-cpp compile in RAD Studio 2010

I can't compile yaml-cpp in RAD Studio 2010. I have error in nodeutil.h template <typename T, typename U> struct is_same_type { enum { value = false }; }; template <typename T> struct is_same_type<T, T> { enum { value = true }; }; template <typename T, bool check> struct is_index_type_with_check { enum { value = false }; }; template ...