« first day (238 days earlier)      last day (4708 days later) » 
00:00 - 16:0016:00 - 00:00

12:01 AM
lol why deo you have a Sexy topic
 
My most common executed command must be svn revert --depth infinity . lately..
 
silly hilight tools. my &#0x01; trick doesn'T seem towork here -.-
 
Happy weekend, folks!
 
Xeo
12:18 AM
@JohannesSchaublitb You know, you edited that message 4 times, but failed to change the "deo" to "do".
 
@AProgrammer Possibly. Haven't dabbled in that in a while.
 
12:37 AM
Anyone else finds that class Attributes : public std::map<std::string, std::string> {}; is better than typedef std::map<std::string, std::string> Attributes;
The former has strong type-safetype and allows forward declarations.
 
Xeo
Except that you must now forward all constructors
 
12:50 AM
@Xeo Yep, it sucks if the class has constructors.
 
@StackedCrooked I do not find it so much as better or worse but as completely different in purpose
 
Anyone knows why this doesn't work?
struct Foo
{
struct Bar {};
};
using Foo::Bar;
It gives the compiler error: error: 'Foo' is not a namespace
 
Going to check but I assume only namespaces can appear where Foo is
Try ::Foo::Bar?
 
Xeo
@StackedCrooked The following allows you to forward declare Attributes on MSVC:
namespace std{

template<class>
class allocator;

template<class>
struct less;

template<class, class>
struct pair;

template<class,class,class,class>
class map;

template<class>
struct char_traits;

template<class,class,class>
class basic_string;

typedef basic_string<char, char_traits<char>, allocator<char> > string;

}

typedef std::pair<const std::string, std::string> AttribPair;
typedef std::map<
    std::string,std::string,
    std::less<AttribPair>, std::allocator<AttribPair>
> Attributes;
:D
 
@Xeo Ok...
 
Xeo
12:59 AM
Even tested!
 
Unfortunately implementations are free to e.g. define pair as template<typename, typename, typename EvilDefaultedParam = ...> struct pair { ... };. And I think it gets worse than that
 
Xeo
Are they?
 
@Xeo but it's it's a typedef. So it doesn't have the advantages of my little trick.
 
Xeo
What trick?
The strong typedef?
 
@Xeo yeah, with the inheritance
Anyone ever tried to emulate a templated namespace with a template struct?
 
Xeo
1:04 AM
Wtf
You want to do something you shouldn't. Really.
 
Xeo
Also, how would you do "using namespace Foo;" if Foo is your struct?
 
@Xeo that's one of the problems :/
 
Xeo
No wait, it isn't
Screw using directives. :)
 
@Xeo I have to use typedef Foo::MyClass MyClass; everywhere....
 
1:06 AM
@StackedCrooked After looking around I don't know if using Foo::Bar is allowed or not unfortunately
 
But I just pretend that I don't want to do using namespace. Isn't that a bad habit anyway? :D
 
Xeo
Oh, and one BIG (bold-italic-uppercase for emphasises) disadvantage: You can't reopen the struct as you can a namespace.
 
@Xeo I boldly don't care :)
@Xeo It could be a big disadvantage, but I wouldn't want to use it on a very big scale anyway.
@Xeo But as you can see in the code sample. It does kind of work :)
I like this. I'm gonna be famous.
 
@Xeo After a bit of digging around, it seems that the 'implementations can add defaulted parameter' claim is common but wrong.
18
Q: Standard Library Containers with additional optional template parameters?

Johannes Schaub - litbHaving read the claim multiple times in articles - I want to add this question to Stackoverflow, and ask the community - is the following code portable? template<template<typename T, typename Alloc> class C> void f() { /* some code goes here ... */ } int main() { f<std::vecto...

So the real reason you can't forward declare is that you are only allowed to open the std namespace to add specializations
 
Xeo
Nice to know.
 
1:14 AM
Apparently this is so thanks to template template parameter!
 
Xeo
@LucDanton My question: Are you not allowed to add new functions / classes to std or aren't you allowed to add anything to it?
 
You can add specializations and that's it
 
Xeo
Do you know the paragraph OTOH?
 
I wanted to find a SO question but it seems googling for "namespace std" ignores the std
Not sure where I should look into the Standard directly
According to section 17.4.3.1.3/1: "Each name declared as an object with
 external linkage in a header is reserved to the implementation to
 designate that library object with external linkage, both in namespace
 std and in the global namespace."

 And according to section 17.4.3.1/3: "If the program declares or defines
 a name in a context where it is reserved, other than as explicitly
 allowed by this clause, the behavior is undefined."
Cross checking (I dug that from Usenet)
 
Xeo
@LucDanton I think I found that thread too
 
1:20 AM
Yeah
You'll notice the bit about defaulted parameters again
 
Xeo
Yep, which should make it valid. And since you only typedef / declare stuff that is already in there, I'm wondering
 
@Xeo You'll love my "using namepace" workaround :D (code.google.com/p/stacked-crooked/source/…)
 
Xeo
@StackedCrooked Can you correct the link? Seems broken for me (in SO chat)
Oooh, Herb was wrong in here.
> Among other things, this allows vendors to provide implementations of the standard library that have more template parameters for library templates than the standard requires
 
@Xeo it works for me
 
Xeo
lol
 
1:23 AM
Sleep deprivation is taking me to new levels of language abuse.
 
Xeo
And how would you do that outside of classes?
 
Is the link working?
 
17.6.4.2
Namespace use
17.6.4.2.1 [namespace.constraints]
Namespace std [namespace.std]
1 The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. A program may add a template specialization for any standard library template to namespace std only if the declaration depends on a user-defined type and the specialization meets the standard library requirements for the original template and is not explicitly prohibited.179
 
@Xeo Ehm, good point!
 
Xeo
I need to paste it manually
 
1:23 AM
Now that's quite explicit wording
 
Xeo
:(
Got that from C++03 or C++0x standard?
 
From n3242 (hence the renumbering)
 
Xeo
n3242 is? I don't know the number for the 03 one..
 
The working draft prior to the FDIS
i.e. the next best thing to the FDIS
 
1:53 AM
hi
 
Xeo
2:39 AM
@LucDanton This is interesting, there is no section called [namespace.std] in the C++03 standard
Or adobe readers search is failing on me
 
Use the previous references for C++03 (from Usenet)
 
Xeo
Ah, it's under [lib.reserved.names]
> A program may add template specializations for any standard library template to namespace std. Such a specialization (complete or partial) [...]
Oh, I never knew you are allowed to add partial specializations!
 
Xeo
2:58 AM
namespace language_lawyer{
0
Q: Why is there no <stlfwd> header and can the non-existance of it be considered a defect?

XeoThe standard library includes an <iosfwd> header, that (forward) declares all streams including any typedefs and defines the char_traits template, including the specializations. Sadly, there is no such <stlfwd> header that (forward) declares all the common STL datatypes and functions...

}
 
Is there any point in an unnamed namespace in a header?
 
Why on earth do people care about largely trivial language esoterica? I got a score of 43 on the most ridiculous and dumb Python question I've ever answered.
And it's because it involved a finicky little language construct not many people knew about. Why do people care so much about stupid stuff like this?
 
3:13 AM
@Omnifarious You don't think there's value in knowing a language inside and out?
 
@wilhelmtell No, there isn't really.
 
Then why are the boost placeholders in bind.hpp placed in an unnamed namespace?
 
Because you can't otherwise define objects in a header
It's a dirty trick that takes a lot of consideration to use
 
@ildjarn There is value in that. But I think there are some far more valuable things. The questions that generally get closed because they are 'too fuzzy' are far more interesting and useful.
 
@LucDanton Non-const objects anyway
 
3:16 AM
Heh they would be const in this case
 
@Luc you can link agains them with an extern.
 
'You can't otherwise define extern objects in a header' would be the correct thing to say
@wilhelmtell Yes
I'm going to dig up that conversion on one of the boost list for the rationale in this case; I doubt they need the extern
 
but then, if the placeholders are inside an unnamed namespace, which is inside namespace boost, there's no way to refer them without bringing in to scope the entire boost namespace.
 
Oh right.
No the namespace is in boost::placeholders
 
lemme double check that.
 
3:19 AM
Even if it were inside boost you'd refer to to them the usual way
 
@LucDanton No, boost::bind's placeholders are in an anon namespace
boost::lambda::bind and boost::phoenix::bind's are not
@wilhelmtell The anonymous namespace is not in namespace boost, it's in the global namespace
 
ideone.com/qBEOo is possible though
 
yeah looking right now at bind/placeholders.hpp
 
I don't know if they do it with using or otherwise.
 
why are they static? the unnamed namespace should be enough.
oh it's for stupid compilers. k
 
3:23 AM
the namespace doesn't affect linkage (that's one of its key feature)
 
@wilhelmtell stupid linkers
 
@Luc unnamed namespace does.
 
It doesn't
 
No it doesn't
 
@Luc unnamed namespace is the equivalent of C's static for the linker.
 
3:24 AM
Nope
 
@Luc yep.
It's wrong to use static for linknig in C++>
 
It's a superior alternative (or so the standard claimed)
 
you use unnamed namespace.
 
Fine I'm going to dig a quote and you'll owe me an apology how about that
 
Ok.
 
3:25 AM
"Although entities in an unnamed namespace might have external linkage, they are effectively qualified by a name unique to their translation unit and therefore can never be seen from any other translation unit"
 
7.3.1.1
1
Unnamed namespaces
[namespace.unnamed]
An unnamed-namespace-definition behaves as if it were replaced by
inlineopt namespace unique { /* empty body */ }
using namespace unique ;
namespace unique { namespace-body } where inline appears if and only if it appears in the unnamed-namespace-definition, all occurrences of unique in a translation unit are replaced by the same identifier, and this identifier differs from all other identifiers in the entire program.94
 
§7.3.1.1 footnote 82
 
Then there's an example
then there's the footnote
 
@wilhelmtell Huh? That's what static does at namespace scope, why wouldn't you use it as such?
 
I accept your apology because it's true that unnamed namespaces are compared all the time to static and because implementation typically get rid of the symbols when they can get away with it (under the as if rule)
But still, if you need something extern, which is all the time when you're using templates, the unnamed namespace doesn't impair that (and that's why I said it's one of its feature).
 
3:28 AM
Was reading exactly that.
Yes, so, I'm right. Thank you.
 
I know why they do it!
 
They do it because the placeholders need to be 'global'.
 
So in fact that's precisely why they use an unnamed namespace: so that std::bind(..., _1) is conforming
 
But they don't want to give them global names.
 
3:29 AM
Unnamed namespace has the same effect of static linking, but it talks to the compiler alone.
 
It shares one of its purpose certainly
 
for what i understand the point is to keep the placeholders in the header, to avoid a library to link against.
 
But under some circumstances it does things you can't do with static
@wilhelmtell And because they have to be extern
 
@wilhelmtell It's partly for that, but it's also partly so they don't have to have top-level extern symbols named really generic things like '_1' and '_2'.
 
@Omnifarious i wouldn't guess that's the point. it actually makes perfect sense to put things in a namespace. see for example std::cout and friends.
 
3:31 AM
Not for _1 and such. In order for the notation to be clean, they have to be global names.
 
@Luc that's the same thing. extern means the entity is elsewhere, for the compiler to relax on the odr.
 
And they get used in places where Koenig lookup wouldn't do the right thing.
 
FWIW, the fact that boost::bind's placeholders are effectively global is considered a defect by the Boost management, and is going to change once Boost.Phoenix v3 is out for a while
 
@wilhelmtell That's not how extern works
 
(boost::phoenix::bind is going to replace boost::bind)
 
3:32 AM
@ildjarn What does global mean in this context?
 
@ildjarn How are they going to implement the placeholders?
 
@LucDanton Meaning not in a named namespace
 
@ildjarn mm? what'd phoenix::bind?
 
@Omnifarious Not sure what you're asking. Boost.Phoenix has been around for a while, you can look at its implementation quite readily
 
@wilhelmtell I realise I may have made things confusing by using the word 'extern' to simply mean 'external linkage'. I don't think I meant the extern keyword in my previous messages (except that last one)
 
3:34 AM
One of my irritations with anonymous namespaces is that most compilers give all the symbols in them external linkage, even if the symbols have names that are not accessible from other translation units.
 
GCC doesn't do that I believe
Checking
 
@LucDanton Depends on GCC version; older GCC didn't have the concept of symbol visibility
 
0000000000000004 b (anonymous namespace)::i
0000000000000000 B j
Lowercase means internal
 
i just find it unintuitive that the placeholders are in global scope. very unintuitive, and very none-standardy and none-boosty.
 
Oh, OK. Why do they have to have names at all?
 
3:38 AM
mm?
 
statics don't end up with names.
 
@wilhelmtell Again, considered a defect and changing in the 1.50 timeframe
 
@Omnifarious It's an object file, not an executable
 
"again": sorry, must have misheard :-S
 
7 mins ago, by ildjarn
FWIW, the fact that boost::bind's placeholders are effectively global is considered a defect by the Boost management, and is going to change once Boost.Phoenix v3 is out for a while
 
3:39 AM
@ildjarn that'd mean i'd need to link against libboost_bind or somethin though. which i'm fine with, of course. and when it becomes standard the compiler will probably do the linkng automatically anyhow.
 
@wilhelmtell Boost.Bind and Boost.Phoenix are both header-only; there's no linking involved
 
@ildjarn so how's the magic done?
 
@wilhelmtell Which magic?
 
inlniing proly
 
I think
 
3:41 AM
huh?
 
Couldn't you make _1 & Co functions?
 
the linking of the objects.
 
@wilhelmtell Defined as const (so effectively static)
 
@LucDanton Oh, I see. I was mistaken. statics end up with names in the .o file too. OK. That makes more sense now.
 
@wilhelmtell All Boost.Proto-based libraries do that for their terminals
 
3:42 AM
k
there are a number of tricks to do that. there's also the std::endl trick.
 
Agreed, but given the library is implemented with Boost.Proto, it uses Boost.Proto rules (which is that all terminals are empty types, and can be declared const/static with 0 overhead)
 
which is effectively what @Luc says, making them functions, only treating them as objects.
i'm not very much familiar with boost.proto. i need to do my reading about that.
but also, i imagine that's going to be a headache now because placing the placeholders in an amespace breaks code.
 
It's a library for creating expression-template based EDSLs
 
edsl?
 
@wilhelmtell There's a deprecation period where the old Boost.Bind implementation will be the default along with a compiler warning. After 3 or so Boost releases, the default changes to the new Boost.Phoenix implementation
Embedded Domain Specific Language
 
3:45 AM
"easter district soccer league"?
 
@wilhelmtell Boost.Filesystem and Boost.Spirit took the same approach (deprecation)
 
yes yes. true. the standard did the same too. things used to be in global namespace.
actually i think that's why they changed from <.h> headers to <> headers.
phoenix is still in beta i gather? so it's going to take time until it's out. and besides, i understand bind is already in the stadnard as is.
so it doesn't REALLY matter that much any more :-S
 
Either it's coming out with 1.47 or they missed the window; I haven't kept up with the lists lately
boost::bind has also several differences with the std version
Which is not officially out either
 
@wilhelmtell Boost.Phoenix is live/released in v2 right now as a sublibrary of Boost.Spirit. In 1.47, Boost.Phoenix v3 is being released as a standalone/proper/official Boost lib
v2 has been stablized since Boost 1.36, and v1 has existed as long as Boost.Spirit has
 
from this it's not clear how you bind a member over a container of pointers.
vector<shared_ptr<T> > cont;
for_each(cont.begin(),cont.end(), bind( ? ));
with phoenix
 
3:57 AM
@wilhelmtell The exact same as with std::bind and boost::bind
 
or is it the same as in the old bind?
so they didn't fix the namespace thing?
 
The placeholders are in namespace boost::phoenix instead of an anon namespace
 
i thought there'd be a difference because it has a "functional" taste, supposedly ..
 
but ADL picks up the phoenix placeholders
 
3:58 AM
well, you can do things with Phoenix's placeholders
E.g. they support every operator
 
@ildjarn ah clever! so that's how it maintains compatbility with the old bind!
 
As does the result of phoenix::bind
 
@wilhelmtell Every namespace is just a using directive away, too
 
@Luc except unnamed ones.
:p
 
Of course, the using directive is provided for free
 
4:00 AM
but it's good. i like it this way. i don't like things floating in space.
unless i ask them too, of course.
it's good to talk about these things. makes me conscious about things much more than reading or thinking.
 
@wilhelmtell Food for thought: Given a class T with a member-function dostuff() and a vector<T*> vec, with Boost.Phoenix the following two are identical: std::for_each(vec.begin(), vec.end(), phoenix::bind(&T::dostuff, _1); and std::for_each(vec.begin(), vec.end(), phoenix::_1->*&T::dostuff);
<3 Phoenix
 
Now that there are lambdas I think I'm going to pick it up
Everytime I need a polymorphic lambda I get mad
 
man bless these people. they write libraries that you look at how you use them and you have no clue how it can work underneath.
like, how can _1 already bind to the right stuff, at call site!?
 
Heh. It can't. Which is great because it means the functor is polymorphic.
 
^^
 
4:13 AM
Tangentially programming related, but is D in numbers, e.g. "1.23D+03" the same as E?
 
Not in 0xDEADBEEF
 
:P, talking decimal
 
mm? what's "D"?
It probably is, in some language, but not in C++.
 
5:15 AM
Is this safe?
struct s { };

int main()
{
    const s& ref = s();
}
 
Xeo
YES
wops
yes
const refs are explicitly allowed to bind to temporaries
 
wait that's a stupid question. yes. we do it all the time in function parameters. :-S
i'm sorry i'm tired i need to sleep :-S
 
cpx
5:27 AM
Hm, In visual studio i was able to compile it with non-const reference and that was because of those C++ language extensions were enabled.
 
 
1 hour later…
6:31 AM
Dam. I'm gonna build one.
 
 
2 hours later…
8:48 AM
2
Q: Creating a utility for defining atomic scopes.

StackedCrookedIn the past I have created a few utility classes that help with multithreading. One of them wraps an object together with a mutex as private variables. It only allows access through another accessor object. The mutex is locked as long as accessor is alive. And is unlocked when all accessors are d...

 
9:20 AM
@wilhelmtell No, we don't. This is a different scenario. Binding an rvalue to a local reference extends the lifetime of the temporary. A function parameter does not do that.
 
Well, it's valid for the scope of the function. There is arguably some similarity.
 
But that's just the normal lifetime of a temporary: Die at the end of the full-expression.
 
@FredOverflow This 'most important const' feature is something that is easily misunderstood.
 
Temporaries do not immediately evaporate. They would be completely useless if they did.
@StackedCrooked I have never used it in production code. Why would I want to write const S& ref = S() instead of simply S val = S() (or even S val if it's not a POD)? What do I gain from the reference here?
 
From the inside of the function you can't distinguish if it's a temporary or not; from this scope there is no notion of the original expression. There just is the reference, and it's valid. From T const& ref = T(); onwards, there also is a valid reference for the rest of the scope.
So I think it's disingenuous to not see the similiarity.
Since however it's not my case that the two are somewhat equivalent I'm not too attached to the idea
 
9:27 AM
@FredOverflow Neither do I used it in production code.
@FredOverflow It's good that it exists for stuff like boost foreach. Or to brag about your arcane knowledge to fellow programmers.
 
@StackedCrooked Boost foreach will die a slow, peaceful death with C++0x's range based for.
 
Meanwhile, boost::fusion::for_each will go on living a moderate, yet very useful life.
 
user379888
I need to get PR of a site entered in a desktop app. Can someone tell me how to do that?
 
@JustAnotherProgrammer keyboard?
 
user379888
@StackedCrooked I mean a good algo for it.
 
9:39 AM
What you mean with PR?
 
user379888
@StackedCrooked: Page Rank of a website. Its should get the Page Rank and perform required task then
 
user379888
The main problem is in getting the page rank from the internet
 
How is page rank defined, exactly?
 
Can you use a webservice for this or are you doing screen-scraping?
 
user379888
@FredOverflow: Its a ranking critaria by Google. You can get it from this site:prchecker.info/check_page_rank.php
 
user379888
9:42 AM
I want to use this webservice into my program
 
user379888
Send the website from console and get its PR
 
If it's from Google, it probably has an API :)
3
Q: Getting Google PageRank via an API (PHP)

Henk DenneboomI have a list of domains and would like to get the: PageRank for all the domains. So just an integer, there must be an API that returns this. The number of results in Google The position of the word of the domainname. For example, "google.com" would be the position of the word "google". This co...

 
user379888
@FredOverflow: Thanks :)
 
user379888
@FredOverflow: Here is a script but I have no idea how to integrate it in C++
<div style="text-align:center;">
<table cellspacing="1" style="margin:10px auto 40px;width:400px;border:1px solid #DDD;text-align:center;">
<tr><td style="background:#D1FFA4;vertical-align:middle;">
<p style="font-size:11px;font-family:Verdana;margin:0px;padding:2px;color:#666;"><strong>Check Page Rank of your Web site pages instantly:</strong></p>
</td></tr>
<form action="http://www.prchecker.info/check_page_rank.php" method="post" style="margin:0px;padding:0px;">
 
I have no experience with scripts, sorry.
 
user379888
9:49 AM
ok :)
 
How do you call a tree class?
 
@StackedCrooked Tree?
 
@FredOverflow I find that I usually end up with a class called Node.
 
A tree is made up of nodes. They're not the same.
 
Once I have the Node hierarchy, I never found a need for more.
 
9:52 AM
Well, I have never found a need to implement a tree myself, so...
 
@FredOverflow You mean do never use tree? Or you don't write them yourself?
 
What do you think "implement" means, write or use?
 
Mmmh I'm looking at the conversion facilities of the draft and I don't understand how to go from the narrow set to e.g. utf-32
> the specialization codecvt <char32_t, char, mbstate_t> converts between the UTF-32 and UTF-8 encoding schemes
 
Section?
 
22.4.1.4 Class template codecvt [locale.codecvt]
Then there's 22.5 Standard code conversion facets [locale.stdcvt]
But those are for going from multibyte (e.g. utf-16) to e.g. UCS-2, and utf-8 <-> utf-16
 
10:05 AM
I'm no expert at this. Have you looked at an example?
 
I was more thinking in terms of std::wstring_convert from 22.3.3.2.2 string conversions [conversions.string]
But this might be different altogether
 
It's probably better to ask a question on SO. You'll reach a wider audience.
 
Actually I'm editing an answer of mine
Apparently you can go from narrow -> wide -> any Unicode
 
10:35 AM
hello all
what are some new nerd questions
 
Am I the only one that uses the acronym "ABBA" to understand the order of construction and destruction of objects?
 
@JohannesSchaublitb Is ++++i UB? ;)
 
Is UB a sin?
Does God kill a kitten for each violation?
 
possibly
 
10:56 AM
oO
 
cpx
hmm
 
hmmmmm
this seems to be a useful construct in C++0x: template<typename T> struct ZeroInitializer { T t; };
So that you can say ZeroInitializer<Foo>() and always have all members of the Foo objects zero even if the Foo object has user defined constructors
 
11:18 AM
@JohannesSchaublitb It doesn't require Foo to have a default constructor?
 
11:38 AM
0
Q: When an array is created by a subexpression, what happens with the temporaries therein?

Johannes Schaub - litbI was reading these two paragraphs of the FDIS (12.2p{4,5}): There are two contexts in which temporaries are destroyed at a different point than the end of the full-expression. The first context is when a default constructor is called to initialize an element of an array. If the constructor h...

@StackedCrooked nopes xD
 
 
2 hours later…
1:29 PM
---> Computing dependencies for libcaca
---> Building libcaca
Error: Target org.macports.build returned: shell command failed (see log for details)
Shitty libraries.
 
 
1 hour later…
2:57 PM
hi
 
was it you that I was talking about for my p = np thing?
 
A while back, yes.
 
good
cause I made a somewhat small advance
 
You're still working on that?
 
2:59 PM
you were totally right about what happens if N = 1,000,000,000 and the sum has a cardinality of 7
but that doesn't make it non-polynomial
I'm pretty sure that if the algorithm is exponential, up to log(f(N)) for some polynomial f, then it still comes out to be polynomial
in the general case
after all, think about it- for any individual cardinality c of subset, the combinations don't increase exponentially for increasing n, they increase by an order of c
so if you could keep c low, then it doesn't really matter- you're still only exhibiting polynomial behaviour
 
nCc = n! / (c! (n-c)!)
 
so if I could prove that the limit on the values is logarithmic in f(N), then the algorithm is still polynomial- even if it exhibits relatively poor behaviour early on
I know
 
Hmm, is log(n!) polynomial?
Isn't O(n!) = O(n^n)?
 
if c = constant, then you've got (n!)/(n-c)!, which means, keep the top "c" elements
which is polynomial
imagine c = 2
(n!)/(n-2)! = (n) * (n-1) = n^2 - n
 
3:05 PM
c = 3 (n!)/(n-3)! = (n) * (n - 1) * (n - 2), which is order 3
 
But in the generic subset sum problem, you don't know the cardinality of the subset.
 
sure, but all I'd have to prove is that it exhibits order c behaviour for only c = log(n) or less
ahem
to be exact, it would c = log(some base)(f(n)), where f must be polynomial
pretty sure that it doesn't matter what the base is
 
Yes, as long as it's constant, the base is irrelevant.
 
my point of the max cardinality is part of the way there already, because it only exhibits a max order of sqrt(2n)
which, I'm pretty sure, is a better running case than Horowitz-Sahni's algorithm, which is O(N2^(N/2)), whereas I exhibit O(sqrt(2n)2^(sqrt(2n)))
if only the minimum cardinality was so easy to identify/prove
I mean, I'm pretty sure that, relatively, it shouldn't be too difficult to generate a minimum cardinality, but it would be too specific to a given data set
 
I'm not sure what else I can say. You turned the task of proving subset sum polynomial into the task of proving this new "minimum cardinality problem" polynomial.
 
3:17 PM
nah, I doubt that a minimum cardinality can be proved in general
I'd have to go back to the inequalities thing
perhaps I should look into decomposing the problem
a sort of dynamic programming solution
 
If I want to get a sequence of bytes, what type should I use?
It's not a number, just a bunch of bytes coming from the network.
Is sizeof(char) guaranteed to be 1?
 
pretty sure that char should be fine
yes, that's the definition of sizeof()
all the other types are measured as multiples of char
 
Good. And what if I want a 4-byte number? unsigned has no maximum size. Is there some "always 32-bit" type ?
 
if you're on a 32-bit architecture, std::size_t
I'm pretty sure that in C++0x and (maybe) in C++03, you can get uint8_t as Standard
but almost all platforms provide them as well
MSVC provides __int32, for example
 
3:33 PM
The FDIS has uint8_t, uint16_t, uint32_t, uint64_t, in <cstdint>. But they're followed by a comment saying // optional.
I think I'll go with those.
If you're in a system/compiler that doesn't support those... Get a better system.
 
3:50 PM
lol
 
Seriously what system wouldn't support those?
An embedded system?
You don't need a BitTorrent client in one of those.
 
I think that even embedded systems do it that way now
 
that even embedded systems support 32-bit and emulated 64-bit arithmetic
 
Oh, I thought you were talking about BitTorrent.
Gosh.
 
3:58 PM
lol
no
don't know where that came from
 
00:00 - 16:0016:00 - 00:00

« first day (238 days earlier)      last day (4708 days later) »