Hi,
I'm trying to create a really simple templated control. I've never done it before, but I know a lot of my controls I have created in the past would have greatly benefited if I included templating ability - so I'm learning now.
The problem I have is that my template is outputted on the page but my property value is not. So all I ge...
Hi,
I'm currently experiencing with the new c++0x variadic templates, and it's quite fun, Although I have a question about the process of member instantiation.
in this example, I'm trying to emulate the strongly typed enum with the possibility of choose a random valid strong enum (this is used for unit testing).
#include<vector>
#in...
I am trying to write a generic allocator class that does not really release an object's memory when it is free()'d but holds it in a queue and returns a previously allocated object if a new one is requested. Now, what I can't wrap my head around is how to pass arguments to the object's constructor when using my allocator (at least withou...
I have begun using Eclipse code templates and am loving 'em! But for existing code they are a bit hard to use. This is easiest with an example.
I have a pre-existing bit of code and I want to wrap it in a try-catch block. Currently I create the try-catch block from the template and then cut-paste the code I want inside the try block.
W...
I am attaching blob image to html mail template and then sending mail to user but in gmail that image is not display and when i saw source of that image then I found that it is adding tag in that image source.So how can I avoid it can anybody help me.
...
<td valign="center" colspan="2">
<a href="" class="table_desc" >
<span class="desc_info_butt"></span>
</a>
text here
</td>
.desc_info_butt{
background:url(Description_Button.png) top left no-repeat;
height:16px;
width:16px;
display:block;
}
For some reason, the image and text appear on two different li...
{% for d in mydata %}
{{ d.title }}
{% endfor %}
However, I would like the first one to be bolded. How can I use the loop to say...if the d is the first one, then bold it?
...
I've got a small bit of DRY going on in code I and others have written that I'd like to reduce but I'm failing to figure out how to get it done. This is legacy COM code but it's interfering with the readability. I'd like to do the following:
bool queryInterface<class T, class V>(T &_input, V &_output, Logger &_logger){
if( FAILED(...
The following code gives an error when it's supposed to output just std::endl:
#include <iostream>
#include <sstream>
struct MyStream {
std::ostream* out_;
MyStream(std::ostream* out) : out_(out) {}
std::ostream& operator<<(const std::string& s) {
(*out_) << s;
return *out_;
}
};
template<class OutputStream>
struct Foo...
Hello, I am after a very lightweight template engine that supports / can be embedded inside Android programs. I've looked at the MiniTemplator (I think that is how you spell it) and that looks great but it loads in only from file and I need to load templates from string and I am not fully confident in changing that code lol.
Can anyone ...
I dislike the default Javadocs generated for me when I create a Class or methods, especially the @author variable, which is the current system username on my windows box.
I would like to change it. Is this possible?
...
I have php scripts that do things like register, login, upload.
I would like to keep the HTML in a seperate file so that say I make a desktop client I can just use the php files to do the login register etc.
Basically to have say a front end, the HTML or desktop client and then only one backend, the php.
Is that possible?
EDIT : Woul...
I'd like to be able to use template deduction to achieve the following:
GCPtr<A> ptr1 = GC::Allocate();
GCPtr<B> ptr2 = GC::Allocate();
instead of (what I currently have):
GCPtr<A> ptr1 = GC::Allocate<A>();
GCPtr<B> ptr2 = GC::Allocate<B>();
My current Allocate function looks like this:
class GC
{
public:
template <typename T>...
I'm looking for a template engine. Requirements:
Runs on a JVM. Java is good; Jython, JRuby and the like, too...
Can be used outside of servlets (unlike JSP)
Is flexible wrt. to where the templates are stored (JSP and a lot of people require the templates to be stored in the FS). It should provide a template loading interface which one...
I followed the other questions on StackOverflow and made custom User Templates. Instead of replacing the factory default Cocoa class template, I have to pick a new user template.
The order that is shown in XCode's New File dialog box is:
iPhone templates first (great if you mostly do iphone development)
Second the User templates
Thir...
hello
I have template that looks like this:
100 template<size_t A0, size_t A1, size_t A2, size_t A3>
101 struct mask {
103 template<size_t B0, size_t B1, size_t B2, size_t B3>
104 struct compare {
105 static const bool value = (A0 == B0 && A1 == B1 && A2 == B2 && A3 == B3);
106 };
107 };
...
120 const typename boost...
template <typename T>
class A
{
public:
T t;
void Do (void)
{
t.doSomething();
}
};
In the above, how do I supply parameters to the constructor of 't' at the time of template instantiation?.
Like, if I had:
class P1
{
public:
P1 (int i, int a) {}
};
class P2
{
public:
P2 (int a) {}
};
I would like to use ...
hello
I am trying to specialize template the following way:
template<size_t _1,size_t _2> // workaround: bool consecutive = (_1 == _2 - 1)>
struct integral_index_ {};
...
template<size_t _1>
struct integral_index_<_1, _1 + 1> { // cannot do arithmetic?
//struct integral_index_<_1, _2, true> { workaround
};
however I get compiler mess...
I have something like the following code:
template<typename T1, typename T2, typename T3, typename T4>
void inc(T1& t1, T2& t2, T3& t3, T4& t4) { ++t1; ++t2; ++t3; ++t4; }
template<typename T1, typename T2, typename T3>
void inc(T1& t1, T2& t2, T3& t3) { ++t1; ++t2; ++t3; }
template<typename T1, typename T2>
void inc...
Since the function template in the following code is a member of a class template, it can't be specialized without specializing the enclosing class.
But if the compiler's full optimizations are on (assume Visual Studio 2010), will the if-else-statement in the following code get optimized out? And if it does, wouldn't it mean that for ...