Ayan
Yes
Mark
I want to learn PYTHON . From where can I get the best source- udemy, edx,Udacity , YouTube etc which one ?
best way to learn is to find a new project idea, find a way how to implement it in language you'd like to learn
Mark
and that's how you'll master programming languages
Singh
👍
Anonymous
hey, i have e template class, and i want a member function to be declared and defined if some condition is true, otherwise it shouldn't be implemented. I tried std::enable_if<...> in different ways but couldn't do that, example: template <typename Type> class Foo { public: void Specific(); // enable if .. void General(); } and i want void Specific() to be implemented if std::is_default_constructible<Type>::value, otherwise, Foo shouldn't have any void Specific() function. In either way, the void General() function should be implemented.
BinaryByter
https://github.com/Wittmaxi/webcpp/blob/master/src/header/base_traits.hpp
BinaryByter
look at how I used enable_if there
BinaryByter
Anonymous
mine is a template class
BinaryByter
it works as well
Anonymous
but let me try
BinaryByter
maybe add a standard template argument
BinaryByter
for example
BinaryByter
template<class A, typename std::enable_if <true, int>::type a = 0> class myweirdtemplatedclassthatIloveimplementing { };
BinaryByter
what does that mean?
BinaryByter
what does it mean to enable a function if something is?
BinaryByter
either the entire class is valid or it isnt
BinaryByter
you will have to make two different classes
Anonymous
it means that Foo<int> has the Specific function but Foo<weird> doesn't
BinaryByter
use template specializsation
Anonymous
you will have to make two different classes
so it will be lots of classes, cuz i have multiple enable_if s
Anonymous
i wish they added this feature :D
Anonymous
thanks!
BinaryByter
Anonymous
think your design over
it's ok now, but it would be much easier to use in that way
Anonymous
like overloading ++ for those types that have ++ overloaded and so on
Anonymous
so i shouldn't write: var = var + 1; instead of var++;
BinaryByter
1) use ++var, its faster
BinaryByter
you can have different overloads for different types
BinaryByter
just overload the operator inside of the type
Anonymous
Teach me master
s/master/masta
Anonymous
1) use ++var, its faster
compiler will optimize it 🤔 var++ is easier for eyes
BinaryByter
var++ is not that much easier
BinaryByter
but if it floats your boat ¯\_(ツ)_/¯
Prometheus
var++?
Anonymous
compiler will optimize it 🤔 var++ is easier for eyes
it will not actually in cases the ++ is overloaded
Anonymous
var++ is not that much easier
because we usually write the thing we modify at the left hand side and the operation is in the rest of the line.
BinaryByter
var++?
++var over var++
Anonymous
var++?
to summon the beast which will increase the variable called "var" by 1
Prometheus
Yeah lol I realized
olli
++var over var++
that's what i always said .... :D Unless you need the side effect from the postfix
Prometheus
I was looking at the wrong group when I typed that. Thought it was part of another convo
klimi
Yes
olli
Btw.. SFINAE does not work on member functions to be more precise / correct.. SFINAE works only for deduced template arguments
BinaryByter
that's rare
it is quite the opposite
Anonymous
Anonymous
and it's needed..
Anonymous
what is needed
Anonymous
SFINAE for member functions
BinaryByter
and it's needed..
SFINAE is kinda abusing a bug (@ollirz is that correct?)
BinaryByter
SFINAE for member functions
how do you imagine that?
Anonymous
SFINAE for member functions
would be impossible
Anonymous
SFINAE for member functions
requires lots of self includings and MACROs
BinaryByter
no...
Oh....
Anonymous
Anonymous
no literally impossible
no it is possible
BinaryByter
how?
Anonymous
no it is possible
show me one implementation that did it
BinaryByter
that would make two classes completely different
Anonymous
just one
BinaryByter
.
this makes one class name act as different classes
Anonymous
yep
Anonymous
.
this is compile time functions
Anonymous
and that's the goal
Anonymous
these functions are not found in the source code
Anonymous
with some exceptions