i found this in this file: http://www.boost.org/doc/libs/1_43_0/boost/spirit/home/phoenix/core/actor.hpp
What does this syntax means?
struct actor ... {
...
template <typename T0, typename T1>
typename result<actor(T0&,T1&)>::type // this line
I know what typename and templates are, my question is about actor(...
I have a list grouped by Region and it currently shows all the items for each city. I want to reduce to only the most recent advisory for each city.
I have tried to use an xsl:for-each statement but I am messing up the names/parameters.
List is called mlc
The list contains the fields:
Title
City
Region
Advisory
DateCreated
TT (calcula...
Hey Everyone,
I'm having this problem while writing my own HashTable. It all works, but when I try to templatize the thing, it gave me errors. I recreated the problem as follows:
THIS CODE WORKS:
typedef double Item;
class A
{
public:
A()
{
v.push_back(pair<string, Item>("hey", 5.0));
}
void iterate()
{
...
Hi guys,
I am wondering about displaying categories in home page.
I have 5 different categories under 1 section. And All categories have as many articles as they have.
Now I want to show the category title and its few articles in home page...
I am not sure about which module or component to use OR can we do it self?
...
There's a bunch of special macros that MFC uses when creating dialogs, and in my quick tests I'm getting weird errors trying to compile a template dialog class. Is this likely to be a big pain to achieve?
Here's what I tried:
MyDlg.h
template <class W>
class CMyDlg : public CDialog
{
typedef CDialog super;
DECLARE_DYNAMIC(CMyD...
I'm writing a T4 template which loads some classes from an assembly, does some analysis of the classes and then generates some code. One particular bit of analysis I need to do is to determine whether the class implements a generic list. I can do this pretty simply in C#, e.g.
public class Foo : List<string> { }
var t = typeof(Foo);
...
I have a linker error I've reduced to a simple example.
The build output is:
debug/main.o: In function main':
C:\Users\Dani\Documents\Projects\Test1/main.cpp:5:
undefined reference tolog&
log::operator<< (char
const (&) [6])'
collect2: ld returned
1 exit status
It looks like the linker ignores the definition in log.cpp....
I'm sure that boost has some functions for doing this, but I don't know the relevant libraries well enough. I have a template class, which is pretty basic, except for one twist where I need to define a conditional type. Here is the psuedo code for what I want
struct PlaceHolder {};
template <typename T>
class C{
typedef (T == P...
I've seen a few related posts, but I can't really make sense of what I need to do to fix a program I'm making for my entry-level C++ class.
My errors are:
Build Final Project of project Final Project with configuration Debug
Ld "build/Debug/Final Project" normal x86_64
cd "/Users/nick/Dropbox/|Syncs/Xcode/Final Project"
setenv MACOSX...
Hi Everyone,
I'm trying to write code that uses a member typedef of a template argument, but want to supply a default type if the template argument does not have that typedef. A simplified example I've tried is this:
struct DefaultType { DefaultType() { printf("Default "); } };
struct NonDefaultType { NonDefaultType() { print...
When I try to compile this:
#include <map>
#include <string>
template <class T>
class ZUniquePool
{
typedef std::map< int, T* > ZObjectMap;
ZObjectMap m_objects;
public:
T * Get( int id )
{
ZObjectMap::const_iterator it = m_objects.find( id );
if( it == m_objects.end() )
...
I have a dictionary called number_devices I'm passing to a template, the dictionary keys are the ids of a list of objects I'm also passing to the template (called implementations). I'm iterating over the list of objects and then trying to use the object.id to get a value out of the dict like so:
{% for implementation in implementat...
I can't touch the html theme but I have access to the css files.
<div class="photos">
<img src="a.jpg" alt="" align="left" />
<img src="b.jpg" alt="" align="left" />
<img src="c.jpg" alt="" align="left" /> //align makes the images wrap
</div>
Unfortunately I can't remove align="left" from the images otherwise this CSS sn...
For example:
template<typename T>
void write(T value)
{
mystream << value;
}
template<>
void write<const char*>(const char* value)
{
write_escaped(mystream, value);
}
template<>
void write<char*>(char* value)
{
write_escaped(mystream, value);
}
template<>
void write<const std::string&>(const std::string& value)
{
writ...
Is it possible to do this kind of specialization?
If so, how?
The specialization in question is marked //THIS SPECIALIZATION WILL NOT COMPILE
I have used VS2008, VS2010, gcc 4.4.3 and neither can compile this.
I know i can avoid this by overloading func but i want to know if there is a way to do this with template specialization. (impr...
Why is the following code invalid?
template <typename S, typename T>
struct B{
void f(T t, S s) {t.f<S>(s); }
};
gcc 4.3.4 complains that it "expected primary-expression before '>' token", i.e. that "S" wasn't a valid primary-expression.
...
It is easy given a container to get the associated iterators, example:
std::vector<double>::iterator i; //An iterator to a std::vector<double>
I was wondering if it is possible, given an iterator type, to deduce the type of the "corresponding container" (here I am assuming that for each container there is one and only one (non-const) ...
So I'm trying to get some code that is written for gcc to compile on Visual Studio 2008. I have a problem that I have narrowed down to this:
class value_t
{
public:
typedef std::deque<value_t> sequence_t;
typedef sequence_t::iterator iterator;
};
This code fails:
1>cpptest.cpp
1>c:\program files\microsoft visual st...
I'd like to prevent clients of my class from doing something stupid. To that end, I have used the type system, and made my class only accept specific types as input. Consider the following example (Not real code, I've left off things like virtual destructors for the sake of example):
class MyDataChunk
{
//Look Ma! Implementation!
};...
Possible Duplicate:
Why do I need to use typedef typename in g++ but not VS?
Hi, recently I accounted with a "simple problem" of porting code from VC++ to gcc/intel.
The code is compiles w/o error on VC++:
#include <vector>
using std::vector;
template <class T>
void test_vec( std::vector<T> &vec)
{
typedef std::ve...