« first day (734 days earlier)      last day (4217 days later) » 

12:00 PM
Make the cloner explicit (don’t know how to word that) only if std::is_incomplete<T>::value?
 
What is this I'm seeing?! MACROS?!
 
wheels::value_ptr<T, wheels::clone_function_cloner<T>>, basically.
 
Oh like that.
I’ll try that.
class Node {
public:
private:
    std::vector<wheels::value_ptr<Node, wheels::clone_function_cloner<Node>>> children;
};
/usr/bin/../lib/c++/v1/type_traits:771:38: error: incomplete type 'eter::Node' used in type trait expression
    : public integral_constant<bool, __is_polymorphic(_Tp)> {};
 
:S
Let me investigate this.
 
I’m trying the following now:
class NodeBase {
public:
    virtual NodeBase* clone() = 0;
};

class Node : public NodeBase {
public:
    virtual Node* clone() { return new Node(*this); }

private:
    std::vector<wheels::value_ptr<NodeBase>> children;
};
 
12:04 PM
>>
> >
 
@LuchianGrigore I’m using C++11, where the lexer needs the AST.
 
> > just to be safe...
 
@daknøk Oh, that might work. But it's annoying as heck.
 
./wheels/include/wheels/smart_ptr/value_ptr.h++:1782:65: error: member access into incomplete type
      'wheels::value_ptr<eter::NodeBase, wheels::copy_constructor_cloner<eter::NodeBase>,
      std::__1::default_delete<eter::NodeBase>>'
        ~value_ptr() noexcept(noexcept(std::declval<value_ptr>().reset())) {
                                                                ^
@R.MartinhoFernandes ^ Might. :P
 
@daknøk try >/**/>
 
12:06 PM
@LuchianGrigore should work since /**/ is whitespace.
And it works.
 
@daknøk Wait, what.
 
Maybe clang is having AIDS today.
But I don’t have GCC. ;_;
Wait I’ll post everything.
 
Hmm, GCC still complains of the incomplete type, not of that weird thing.
 
Ask on Stack Overflow, maybe the guys there can help...
 
12:09 PM
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
@LuchianGrigore They’d have to be familiar with wheels::value_ptr. :P
One day, will be more popular than .
 
@LuchianGrigore What? Ask a "debug the robot's code for me" question?
Hmm, on GCC it makes the destructor not noexcept for some reason.
 
that seems like a compiler error, so no debugging required :P
 
@LuchianGrigore The compiler needs to be debugged, silly.
 
struct nodebase {
    virtual ~nodebase() noexcept(false) {}
    virtual nodebase* clone() const = 0;
};
struct node : nodebase {
    ~node() = default;
    wheels::value_ptr<nodebase> ptr;
};
This compiles.
 
12:12 PM
uuuuu C++11
fancy
 
But it should compile with the dtor defaulted on the base, i.e. noexcept(true).
 
Shouldn’t ~node() be virtual?
 
^ it is silly
 
virtual doesn't need to be repeated.
 
12:13 PM
I am a noob, I admit.
 
:wq!
damn...
 
@R.MartinhoFernandes Oh, I never knew. Is that only for dtors or also for member functions?
 
everything
 
@daknøk Anything.
 
12:14 PM
@R.MartinhoFernandes: Wasn't aware of that one. Nice. 2 less keystrokes.
 
@ereOn There's also ZQ for :q!.
Somehow ~value_ptr is noexcept(false) on GCC. Given that clang is barfing on the noexcept specifier, I guess there might actually be an issue there.
 
@R.MartinhoFernandes: Not sure I will be able to change my habits, but worth the try. Thanks.
 
@R.MartinhoFernandes It doesn’t with clang. Hmm.
 
ZZ is super awesome. It's not only less keystrokes, but it's on the same key.
@daknøk Complains about the same thing? The reset on the noexcept?
 
@R.MartinhoFernandes I copied your code exactly, it says:
./wheels/include/wheels/smart_ptr/value_ptr.h++:1782:65: error: member access into incomplete type
      'wheels::value_ptr<eter::nodebase, wheels::clone_function_cloner<eter::nodebase>,
      std::__1::default_delete<eter::nodebase>>'
        ~value_ptr() noexcept(noexcept(std::declval<value_ptr>().reset())) {
                                                                ^

src/scene.hpp:30:37: note: in instantiation of template class 'wheels::value_ptr<eter::nodebase,
      wheels::clone_function_cloner<eter::nodebase>, std::__1::default_delete<eter::nodebase>>' requested here
 
12:16 PM
Yeah. There's definitely something fishy there.
Does clang compile if you change that line to ~value_ptr() noexcept(noexcept(std::declval<deleter_type&>()(std::declval<pointer>()))) {?
I don't have clang around right now.
 
sec
 
noexcept(noexcept(...)) looks so silly.
 
A boob with three nipples.
@R.MartinhoFernandes Did that, and the error is gone.
However, I got two new errors.
./wheels/include/wheels/smart_ptr/value_ptr.h++:406:5: error: no type named 'type' in 'std::__1::enable_if<false, const
      wheels::meta_detail::enabler>'
    using Invoke = typename T::type;
    ^~~~~
./wheels/include/wheels/smart_ptr/value_ptr.h++:480:5: note: in instantiation of template type alias 'Invoke' requested
      here
    using EnableIf = Invoke<std::enable_if<All<T...>::value, decltype(_)>>;
    ^
./wheels/include/wheels/smart_ptr/value_ptr.h++:1696:53: note: in instantiation of template type alias 'EnableIf'
 
Note that some line numbers are increased by one in those error messages.
I commented out the original line.
 
12:21 PM
@R.MartinhoFernandes The internal pointer, yes, always points to that, as it is the value.
 
@DeadMG But that's an assumption that limits its usefulness.
 
@R.MartinhoFernandes How so?
 
C++ template rules are more complex than the PHP parser.
2
 
It doesn't work if you don't have a pointer to the most-derived class.
 
that's not hard, since the PHP parser is so terrible.
 
12:25 PM
empty(bar()) is a syntax error in PHP.
 
@R.MartinhoFernandes No shocker there. If you want to create a value of type T, you need to know T.
 
@daknøk That's a SFINAE failure, as in, it should SFINAE, but became an error :( I need to look up this noexcept thing.
@DeadMG But I don't want to task the pointer with creating it.
 
SFIAE
 
@R.MartinhoFernandes The pointer owns the value just like std::vector owns it's internal storage.
 
I want flexibility when creating the objects.
 
12:26 PM
then you'll have to pass an allocator of some design
 
No, I don't want that.
I want to pass a pointer.
 
@daknøk Who's interested in an empty bar anyway.
 
then you're fucked
 
Creation is done outside.
 
then you can't cleanup, either.
which pretty much breaks everything
 
12:27 PM
What?
 
C++ is fun when using RAII and exceptions, but when it comes to polymorphism and template magic, I cry for C, pointers and manual memory management.
 
Clean up is done with a deleter.
 
ah
so you're fine to clean up with a deleter but not allocate with an allocator?
 
It's a virtual dtor by default, but customizable.
@DeadMG I don't allocate.
 
well, I have to admit that now I have no idea WTF exactly your value_ptr is supposed to do
 
12:28 PM
Just like unique_ptr and shared_ptr don't allocate.
 
they're not values
 
@DeadMG polymorphism with value semantics.
 
Best question title ever. — john 2 hours ago
 
what I have is more like boost::any but where the held type derives from an interface which you can access
that's what I had in mind
 
Yes, and it requires public copy members, and that's a no-no here.
 
12:30 PM
Danish folk say letters in a completely different way :O
 
then restrict it to move-only values
 
friend class boost::any; :D
 
@DeadMG That makes no difference. Moving still slices.
 
not if you just move the internal pointer
then the actual derived types don't require any such operation
well, except construction, which could be hilarious for a non-movable type
 
What internal pointer? The internal pointer of derived, that doesn't have any internal pointer?
 
12:32 PM
@R.MartinhoFernandes The value_ptr's internal pointer.
 
> Apache CouchDB has started, time to relax.
 
I'm talking about this line here: template<typename Der> value_ptr(Der t) {
 
he he
 
@R.MartinhoFernandes Right. It could be completely replaced by a factory function that does not require movability if you want.
 
This requires a copy or move, but I want to work with non-movable non-copyable types.
 
12:33 PM
I simply used that approach because it's quick and easy for most classes
but it's not the only way to go
a make_value kind of factory could in-place-construct
 
@DeadMG I would expect most polymorphic classes to be non-copyable and non-movable.
 
I wouldn't
but that's just me
 
Why not?
Doing otherwise is inviting slicing.
 
... except I've never, ever sliced anything, and all of my derived classes are copyable and movable
IME people quote slicing a lot as a reason for doing things, but it hardly ever actually happens
 
@DeadMG I can't argue about that kind of argument.
 
12:35 PM
true
so here's a slightly different one
just put in your derived classes a ctor from the base class with a static assertion failure in it
 
0
Q: When should I use C++ AMP

AbyxWhen should I use the C++ AMP (or shouldn't use it)? What is an overhead of AMP? How long it takes to copy data to GPU memory and back? What is a minimal data size when AMP starts to decrease performance?

 
wait, or maybe I meant the other way around
 
^ I can't believe I've asked an "explain me that thing"-style question
 
@DeadMG Nope, that approach won't ever work.
 
oh well
 
12:36 PM
Because you're dealing with runtime known types.
Can't static assert against them.
 
but the point is
you can use a factory function to dodge this specific bullet anyway
but then I'm not sure why you'd have value_ptr over unique_ptr.
I mean, the whole point of value_ptr is to have copy semantics, no?
else you've just got a renamed unique_ptr
 
@DeadMG Nah, line 16 also requires the copies.
@DeadMG I guess the most common use is what daknok was doing: putting stuff in a vector and getting copies.
 
@R.MartinhoFernandes Which kind of requires, to maintain value semantics, that the derived class is indeed copyable, no?
 
@DeadMG Conceptually, yes, but I want to keep it away from the public interface (so is_copy_constructible<T>::value is actually false).
 
I don't see how
whether you call the copy constructor or clone, you're still copying
 
12:41 PM
I’m terrible with templates, but something like this may already fit my needs, if boost::any supported move semantics.
 
It isn't :(
Three Four iterations of boost since C++11, and still nothing. Fuck them.
 
Aid me in creating Wide, and we shall forever rule the Galaxy as master and apprentice!
3
where I'm the master, just in case you were wondering
 
Ah, so you die by my hands. Nice.
 
eventually, after I spend like 40 years owning everyone
 
@R.MartinhoFernandes s/fuck/fork/
 
12:45 PM
In the Expanded Universe, Palpatine cloned himself (seriously, why the fuck wouldn't he?).
 
TBH, Boost needs a cleanup just as badly as the Standard lib
@R.MartinhoFernandes Ino.
 
Rewrite Boost in Haskell and use foreign function interface. :P
 
@DeadMG Yeah, there are some people in the committee that think the same.
 
well, for one, they need to strip all the functionality duplicated between Boost and the C++11 lib
and then upgrade all their libraries for at least MSVC10 C++11 support
 
Yeah, having less C++11 support than MSVC10 does sound embarassing.
 
12:48 PM
very embarassing
IMO they should just split between Boost03 and Boost11
 
I mean, there are certainly places where I could understand that adding moves was secondary, but optional and any?
 
I need boost::unsafe_any_cast which doesn’t throw bad_any_cast.
Or well nvm, it’s one if statement. Who cares.
 
@DeadMG Anyway, I'm going to consider this in a background thread, and since I plan to rewrite value_ptr anyway, I may change it.
 
tis fair enough
 
gist.github.com/3918052 all I need now is move semantics in boost::any.
 
12:57 PM
Beware of is_base_of and reference/pointer types.
base is not a base of derived&.
 
Oh yeah. Hmm.
 
I had that same bug before :)
 
template<class T>
using make_bare = std::remove_cv<typename std::remove_reference<T>::type>;
 
I call that "bare".
 
“make_bare” to be consistent with <type_traits>.
 
1:00 PM
"bare" is also a verb.
 
BARE ALL THE THINGS!
 
@R.MartinhoFernandes Oh. Of course.
 
I know.
 
template<class T>
using make_bare = std::remove_cv<typename std::remove_reference<T>::type>;
//...
typename make_bare<T>::type

// becomes

template<class T>
using make_bare = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
//...
make_bare<T>
 
1:04 PM
Inconsistent with <type_traits> —> confusing. :P
I’d do MakeBare then as suggested in your blog post.
 
So many emails
 
@CatPlusPlus ctrl-A del
 
1:24 PM
shift-delete
 
# rm -rf /
 
# rm -rf / --no-preserve-root
 
Is there a way to make apache forward a virtualhost to another port ?
 
If I can laugh at film in foreign language, it must be good comedy
 
@DeadMG Just curious, how does it look?
 
1:32 PM
could you be more specific?
 
@jalf comes another:
Why the downvote? This is a perfect question, with a nice SSCCE. See my answer for more reasons why this is a legitimate question. — sehe 2 mins ago
 
@thecoshman You laughed at that? I think I missed the joke then. I feel robbed of four minutes of my life.
@DeadCicada It's a pretty normal barred spiral galaxy.
 
@R.MartinhoFernandes I found it amusing enough
 
Not cool dude, give him back his four minutes.
 
@DeadMG "What's its purpose and what does it look both functionnally and syntactically"
@kbok I think there's a module for that
 
1:35 PM
the purpose is to replace C++ and it looks like C++ but a lot cleaner and simpler to use
 
@DeadCicada Yep, stackoverflow has the answer, as always
 
@DeadMG Does it mean it looks like a cleaner and simpler pile of shit? ._.
5
 
And it's trivially simple
 
naw
 
@DeadCicada Nicely done, lady.
 
1:36 PM
lol, a simple pile of shit
 
most of the shit in C++ was part of the cleanup
 
That's the PHP motto. "It's a pile of shit, but it's easy to learn. It's an easy pile of shit."
 
@thecoshman I'm really curious. What was I supposed to see? All I saw was some dudes killing cows and talking to each other.
I also heard the words "Desert Eagle" somewhere.
 
yeah, that's about all I got, but it tickled me well enough. The tense build up, then the way the farmer joins in playing with the guns
it's silly alright
 
O... k...
@thecoshman Farmer? I thought he was a hunter.
 
1:40 PM
@DeadMG I'd like to see how it looks then
 
Looks like this.
 
to perform any particular function?
 
@R.MartinhoFernandes I assumed he was the owner of the field, thus the reason he comes running across all "hey wtf man! those be my cows!"
 
@R.MartinhoFernandes lol
@DeadMG Whatever you want, a spec, a piece of code, anything
 
I'd like to see how it looks to.
 
1:42 PM
I did have a spec, but it's down, mostly because it sucked
 
Like, not hello world.
 
@thecoshman Oh. I thought he was too friendly to be complaining about that. I mean if those were his cows, I would expect him to be pointing his gun at the guy shooting his cows, not discussing guns with him.
"Oh look, that guy is shooting my cows. Let's see what gun he is using!"
 
@R.MartinhoFernandes I have no idea, I think @CatPlusPlus might be able to fill us (not sure what language it was exactly... or what he speaks... sweedish perhaps?)
 
Hmm, when I put it like that, it does sound a bit funny.
 
I have a recurring problem and I don't know if i'm solving it the right way.
 
1:44 PM
@thecoshman Eh?
 
@R.MartinhoFernandes @thecoshman Read the second comment ;) The start is translated there
 
I receive from an external library a vector<pair<enum Id, double val>> and I have to fetch it inside a struct where each ID matches a different data member
 
let me see if I can dig out some of my old code samples
 
@thecoshman yeah, the first guy is threatening and insulting the cow for staring at him and eventually shoots it. The guy running over owned the cow, and is pissed off, but also a huge gun nut, so he kind of forgets about the cow during all the gun talk
and it's Danish :)
 
1:45 PM
@NikiC do I look like a reader?
 
Hello.
 
like struct mystruct { double a,b,c,d,e,f; };
 
@thecoshman Evidentially you're reading this chat :P
 
@Rapptz Hi
 
@jalf hah! I understand that language as well as I thought I did!
@NikiC I'd love a beer thanks!
 
1:46 PM
How would you do it ?
 
Dispatch table full of pointer to members? Only really works if they truly are the same type.
 
@thecoshman So did I! idshfihfgi sqdfhksqkshdf sdfhkhf
 
@LucDanton I did that, but it feels clumsy in the end
 
@DeadCicada herva derva slerva curva?
 
@LucDanton They are
 
1:47 PM
@jalf Ok, so it was a funny video after all.
I still feel like those four minutes could have been spent better, though.
 
Plus it assumes the ids are consecutive.
 
Not necessarily
 
here are some examples I wrote up a while ago
 
   static sns_offset_info info[] = {
      {&Sensitivities::m_delta, seSensDELTA},
      {&Sensitivities::m_gamma, seSensGAMMA},
      [...]
      {0, -1}
   };
 
the last one's a bit funky through, as I used C++ iterator-style ranges, which I'm going to replace with something else
 
1:52 PM
Don't see anything fishy ?
 
modules
 
probably forgot access specifier, lol
 
Type inference?
 
yep
 
> prolog
wat
 
1:54 PM
function prolog
it's mostly used for SFINAE-esque actions- you can remove a function from overload resolution by returning false.
 
@kbok I'd rather access the member via info[id] than doing a search.
 
so in this sample, if it's a valid function, then the value overload is removed
 
@R.MartinhoFernandes yeah, humour tends to fall apart quickly when it has to be translated. :)
 
Can be info[id + offset] if the ids are consecutive but do not start at 0.
 
Is that how Wide looks like?
 
1:57 PM
@LucDanton No, they're arbitrary values :(
 
give or take
 
@LucDanton I build an array first, then construct a map for it, since I have no syntax-efficient way of building the map directly.
 
erm
 
I understand Decltype(val) but how would Decltype(*src.Begin) work?
 
You're on your own.
 
1:58 PM
@DeadCicada The Decltype function takes an Expression.
it's kinda similar to C++'s decltype.
 
@DeadMG Can you should how the compile-time / meta stuff looks in Wide?
 
I just did- the sample performs (the equivalent of) SFINAE :P
 

« first day (734 days earlier)      last day (4217 days later) »