Anonymous
Or stop using vs and use cl.exe by command line
klimi
ahhh
klimi
im google
Anonymous
are u sure this isnt ur fault?
Dima
klimi
https://social.msdn.microsoft.com/Forums/vstudio/en-US/f59b62b4-beb6-4cd2-98d2-46f0613e3af1/socket-fails-when-using-sockraw-in-win7-vc-10-express?forum=vcgeneral
olli
Why no move in constructor?
klimi
first....
klimi
just google ...
olli
Wym?
Sorry?
BinaryByter
Wait
BinaryByter
I could make a class assert that throws itself
BinaryByter
That would be more minimal
BinaryByter
Where minimal correlates with clean
olli
assertionFailure(std::string s) : containedMessage(std::move(s)) {} Would prevent the default constructor and copy assignment operator from being called
olli
Mhh makes sense
Just wanted to know whether there are reasons against it
Anonymous
Wym?
He probably means why didn't use the move assignment operator overload for std::string instead of copying
Anonymous
Oh... he wrote it sry
Anonymous
Ok i solved that problem, but another one came out...
Anonymous
I just recive the 0xcc byte https://paste.ubuntu.com/p/Hd5FVQ9zYc/
BinaryByter
I have a class that (publicly) inherits from another class. For some reason I can't access that other classes members
BinaryByter
Does anybody have an idea?
BinaryByter
to give you some more context
BinaryByter
class Layer; class OutputLayer : public Layer;
BinaryByter
the function the error comes from is
BinaryByter
OutputLayer::updateLayerSizes
BinaryByter
template <class floatType> void OutputLayer<floatType>::updateLayerSizes(unsigned int _size, unsigned int _inputSize) { size = _size; inputSize = _inputSize; neurons = std::vector<floatType>(Neuron<floatType>(size), size); }
BinaryByter
size, inputSize and neurons aren't found
olli
What's the visibility of your Layers class members?
BinaryByter
all public
olli
Can you provide a minimal, verifiable example?
BinaryByter
Anonymous
.
BinaryByter
header file template <class floatType> class Layer_test { public: int size; int inputSize; std::vector<Neuron<floatType>> neurons; }; template <class floatType> class OutputLayer_test : public Layer_test<floatType> { public: void updateLayerSizes(unsigned int _size, unsigned int _inputSize); }; cpp file template <class floatType> void OutputLayer_test<floatType>::updateLayerSizes(unsigned int _size, unsigned int _inputSize) { size = _size; inputSize = _inputSize; neurons = std::vector<floatType>(Neuron<floatType>(size), size); }
BinaryByter
olli
Did you miss the public or protected inside Layer_test ?
BinaryByter
I did
BinaryByter
its corrected
BinaryByter
same issues still
olli
size, inputSize and neurons are private
BinaryByter
code edited, sorry
BinaryByter
Should I risk stackoverflowing?
olli
^
sorry for the delay, just arrived at home The following works on my system header (a.hpp) #include <vector> template <class floatType> class Layer_test { public: int size; int inputSize; std::vector<floatType> neurons; }; template <class floatType> class OutputLayer_test : public Layer_test<floatType> { public: void updateLayerSizes(unsigned int _size, unsigned int _inputSize); };source (a.cpp) #include "a.hpp" template <class floatType> void OutputLayer_test<floatType>::updateLayerSizes(unsigned int _size, unsigned int _inputSize) { this->size = _size; this->inputSize = _inputSize; this->neurons = std::vector<floatType>(this->size); } int main() { OutputLayer_test<float> x; x.updateLayerSizes(1, 1); return 0; }
olli
I would consider moving the implementation into the header as well, since its templated
olli
Long story short.. Since you use templates you must refer to the members of your base class using this
olli
another option would be to prefix Layer_test<floatType>:: e.g. Layer_test<floatType>::size
olli
@linuxer4fun did it work?
BinaryByter
@linuxer4fun did it work?
I was forcedly moved from my computer by my dad
BinaryByter
Oh!
C++ YOU INCONSISTENT LITTLE PIECE OF SHIT
Anonymous
why are you splitting up the templates?
Anonymous
@QNeko told me to
you should never EVER do that
Anonymous
it gets rid of the only reason to use templates
BinaryByter
Oh shit xD
BinaryByter
Then ill do the C# way
Anonymous
if you split up the template implementation you will end up having to tell the compiler specifically which versions of the template to compile
Anonymous
And if that's what you are trying to do then do it
or you can keep them in one file and not have to write near the bottom a line of code saying to compile it for this class over here
Anonymous
if you want to split it up i would suggest just using a regular C++ class
Anonymous
it is just bad programming practice to have that exposed like that
olli
Btw you can split the implementation but you must include it
BinaryByter
even still
Two accessors for each of those things? Are you nuts?
Anonymous
if it is protected you can use them as private member variables in all inherited classes
Anonymous
giving you the ability to treat them how you do but also prevents other idiots who are using your class in the future from manually changing them
Anonymous
if it is protected you can use them as private member variables in all inherited classes
provided that the inheritance is either public or protected
Anonymous
i believe it also works with virtual inheritance but i forget if it does or not
Anonymous
Hello everyone