I am reluctant to say I can't figure this out, but I can't figure this out. I've googled and searched Stack Overflow, and come up empty.
The abstract, and possibly overly vague form of the question is, how can I use the traits-pattern to instantiate member functions? [Update: I used the wrong term here. It should be "policies" rather ...
I have some code that compiles and runs on MSVC++ but will not compile on GCC. I have made a test snippet that follows. My goal was to move the static method from BFSMask to BFSMaskSized. Can someone explain what is going on with the errors (esp. the weird 'operator<' error)? Thank you.
In the case of both #defines are 0, then the c...
I am making my own XSL stylesheet which will perform different views on the same XML document
Because the XML document is so large, i would like some links at the top of the outputted page to call each template that will be used to display the data.
At the moment I can create links that use anchors to a place in the document but it wo...
For my bachelor thesis I want to implement a shopping (price comparison) portal prototype based on XML Data.
The main requirement is to get a very clear and customizable HTML template, which should be hosted by the customer on his own webserver.
I'm not very sure if XSLT meets this requirements, as it generates a lot of xsl-related cod...
Usually, when people click on a link, I have onclick bound to it. And then return false.
When people click with "control", they expect a new page to open up. Therefore, I want to ignore the onclick AND/OR detect it. How do I do this?
...
Hi, I'm relative new to C++ and my background is in Java. I have to port some code from Java to C++ and some doubts came up relative to the Object Java's class. So, if I want to port this:
void setInputParameter(String name, Object object) { ..... }
I believe I should use void* type or templates right? I don't know what's the "standar...
Please take a look at this code:
template<class T>
class A
{
class base
{
};
class derived : public A<T>::base
{
};
public:
int f(typename A<T>::base& arg = typename A<T>::derived())
{
return 0;
}
};
int main()
{
A<int> a;
a.f();
return 0;
}
Compiling generates the following error message in g++:
test.cpp: In func...
I am using the following code:
<ListBox
x:Name="lbItems"
Grid.Row="1"
Margin="2">
<ListBox.Template>
<ControlTemplate>
<Border
Background="{StaticResource DarkerBrush}"
Width="{Binding Path=ActualWidth, RelativeSource={RelativeS...
I'm trying to testing a concrete object with this sort of structure.
class Database {
public:
Database(Server server) : server_(server) {}
int Query(const char* expression) {
server_.Connect();
return server_.ExecuteQuery();
}
private:
Server server_;
};
i.e. it has no virtual functions, let alone a well-defined int...
I have a parent class which is templated, and a child class which implements it.
template< typename T1, typename T2>
class ParentClass{ . . . };
class ChildClass : public ParentClass<MyT1, MyT2> { . . . };
And I want to have a pointer which I can use polymorphically:
ParentClass<T1, T2>* ptr;
ptr = static_cast<ParentClass<MyT1, MyT2>...
How do I simplify this templated vector initializer loop using lambdas or some kind of STL transform?
template<typename T>
template<typename... Args>
void InitToRandomValues(vector<T>* retval, int n, RNG& rng, Args const&... args) {
retval->resize(n);
for (auto it = retval->begin(); it != retval->end(); ++it) {
typename ...
Hi folks,
I am a new Djangoer, and figuring out how to build custom widget, my problem is cannot get the MEDIA_URL in my widget's template, while the form use MySelectWidget able to get the MEDIA_URL itself.
#
#plus_sign.html
#
<a href="" class="" id="id_{{ field }}">
<img src="{{ MEDIA_URL }}images/plus_sign.gif" width="10" height...
Stepping through my program in gdb, line 108 returns right back to the calling function, and doesn't call the copy constructor in class A, like (I thought) it should:
template <class S> class A{
//etc...
A( const A & old ){
//do stuff...
}
//etc...
};
template <class T> class B{
//etc...
A<T> ReturnsAnA(...
Hi2All..
I have some null struct, for example:
struct null_type
{
null_type& someNonVirtualMethod()
{
return *this;
}
};
And in some function i need to pass reference to this type.
Reason:
template <typename T1 = null_type, typename T2 = null_type, ... >
class LooksLikeATupleButItsNotATuple
{
public:
LooksLik...
Hi,
I want to create a template class in C#, for example:
public class Foo<T>
where T must inherit from a known class.
I cant seem to find the syntax for that.
Thanks, Malki.
...
hi, i am having issues with my django templating system, i have a base.html file, which contains the content which will be common on all the web pages of the web site, the base.html file fetches some dynamic content, like the categories and the archives, which are passed to it by a python file, which fetches the categories and the archiv...
I am under the impression that if I set it as a template in Dreamweaver, any changes made should be saved to a new filename. I've copied the "template" that I made and sometimes I forget to save it as a different file name and it would overwrite previous web content. I just don't get the point of "save as template" if it works just like ...
I would like to store pointers to a Base class in a vector, but then use them as function arguments where they act as a specific class, see here:
#include <iostream>
#include <vector>
class Base {};
template<class T>
class Derived : public Base {};
void Foo(Derived<int>* d) {
std::cerr << "Processing int" << std::endl;
}
void Foo(...
#include <vector>
using namespace std;
int main()
{
vector<int> *list = new vector<int>[33];
delete[] list;
return 0;
}
Any reason why the delete SIGSEGVs?
...
This is probably going to be a really simple explanation, but I'm going to give as much backstory as possible in case I'm wrong. Advanced apologies for being so verbose. I'm using gcc4.5, and I realize the c++0x support is still somewhat experimental, but I'm going to act on the assumption that there's a non-bug related reason for the ...