Ever wish you could do something like this in C++? Create a function that takes one parameter and returns two values?
const char * fileBegin;
const char * fileEnd;
(fileBegin, fileEnd) = AFunctionThatReturnsAPairOfStrings(fileName);
It is possible, with a slight modification. Returning two items in a struct or class is, of course, not a new idea. But I want the maximum ease for extracting the results and assigning them to variables.
Update: This is exactly what Boost tie does.
const char * fileBegin;
const char * fileEnd;
make_refpair(fileBegin, fileEnd) = mmapFile(fileName);
I've defined a simple class and an accompanying function make_refpair to allow this, which I describe below. It seems like an obvious solution, but I can't quickly find anybody who's done this before. E.g. they miss this on stackoverflow. Of course, there is nothing novel in returning a pair<>, but I want the convenience of assigning both variables to the contents of the returned pair. Anybody seen something similar/better?
Aaron
My parents run Larkfield Bed and Breakfast and I'm trying to update their site a little. It's hosted on something called 'Little Ireland' and their syntax is a bit strange.
For example, I need to enter something like .head1Larkfield Bed and Breakfast.endhead1 to get a H1. I can't enter HTML in because it htmlencodes it. Any ideas on how I might encode links - maybe something like .link ?
Here's a few things I might work on someday...
Any ideas?
I recently bought a Dell Precision T3400, but the Debian Etch DVD wouldn't install. Ubuntu worked fine, but after trying a few different kernels I found out about Etch And A Half and it worked for me with an otherwise standard Debian Etch installation. I'm still playing with it and expect to possibly have to change a few things - for example sound didn't work straight away but it's working now.
Recent comments
10 weeks 4 days ago
13 weeks 5 days ago
14 weeks 4 days ago
19 weeks 1 day ago
19 weeks 1 day ago
32 weeks 6 days ago
44 weeks 7 hours ago
44 weeks 8 hours ago
45 weeks 3 days ago
45 weeks 3 days ago