« first day (344 days earlier)      last day (3681 days later) » 
00:00 - 19:0019:00 - 00:00

12:00 AM
for(unsigned int n = 1; n < num + 1; ++n) printf("%llu\n", fibonacci(n));
how many times does fibonacci(n) get called?
 
Whoa there Santa, I hope that there is not only one of you...
@rolfl n times, but isn't the calculation constant? (My knowledge in Big-O is limited, if you can't tell)
 
I see a loop, and say not O(1).
But, you are not counting the loop?
 
@rolfl I was more looking inside of the loop, loops are always > O(1).
 
12:18 AM
RELOAD
 
@syb0rg: Looks like the Op didn't like my edit. Should it just be rolled back, or be edited less?
1
Q: Pre Java 5 Thread : How to further optimize it?

SudhakarI would like to revise the fundamentals of Java Threads on Pre-Java5 world , so that i can further appreciate + understand improvements brought forward in Java 6 and beyond. I started of with a Custom collection I would need help on : Things i am doing wrong / grossly overlooking How to make...

 
@Jamal Your version looks way better. Roll it back and leave a comment, and if he undoes it I think that could be grounds for a super-ping so we can correct him.
 
Okay. In these cases, it may be good to be heard from a non-mod.
But if I've taken out anything important, then it can be added in.
 
@Jamal I'll leave the comment. Should I perform the rollback as well?
 
Yes
 
12:23 AM
@Jamal I didn't see anything important removed. I'll double check.
@Jamal Improvements on the comment?
Please don't revoke edits on your posts unless they vandalize it in some way. The past edit you undid was more easier to read and understand, which can possibly reduce review time. For the sake of quality, I'm rolling back to that edit. — syb0rg 1 min ago
 
Looks good! He has one other question with this same noise, but I won't bother with it now.
Darn, I missed some things in the first edit.
 
12:39 AM
@Jamal And I missed some stuff in my minor editing of your edit.
 
Oh well. Maybe someone else will notice them and edit.
 
12:59 AM
0
Q: generating random and secure csrf tokens. is this good enough?

r3wtbasically, i googled around for secure random number generation and random string generation, combined them with some user data. is this good or am i totally offbase. I don't know much about cryptography but i do not see much alternative, other than some bad code that gets copied around alot with...

 
1:42 AM
Hey @JeffGohlke
 
Hi everybody.
 
Hello @JerryCoffin
 
Hi
 
Brb
 
hi
 
1:51 AM
@MatsMug Congratulations on 10k!
6
 
Wow, missed a bunch, it seems.
Been playing games
 
Yeah, congrats mug... :P
*looks for more questions to review*
 
10K!!
8
Thanks!
 
2:10 AM
360 rep remaining. If only it were 180. :-P
 
0
Q: Display text on video screen

user3491862The code displays a video that will play a video and then display some text on the screen at specific locations on the video screen. The code works but I would like to see if I could change somethings to make it better and how I would do that. You should be able to just copy the code into a web ...

 
2:30 AM
This doesn't seem on-topic to me:
2
Q: Why does this Python maze-solver NOT get stuck?

LenoxusI wrote the following Python program, which reads text files as mazes and displays the solution with a trail of Xs. The files must have an S for the start and an E for the end, and the walls must be +s, with everything else an empty space (or line break). The basic algorithm is this: The maz...

 
3:12 AM
@Jamal You've almost hit the rep cap for today?
or was that yesterday?
 
@syb0rg Yes--180 yesterday, 0 so far today.
 
@JerryCoffin I thought it was a bit soon in the day :)
 
That's correct. So I almost hit it yesterday and haven't gained any so far today.
...looks like Santa was way ahead of me. :P
 
Good meta-post:
6
A: Hi! What brings you here today?

janosBefore I answer, I wonder how many programmers really understand the importance of code reviews in the lifecycle of software construction. It was not until I read this blog post that I realized the impressive evidence showing that code reviews significantly reduce bugs. Doing code reviews saves ...

 
4:07 AM
@syb0rg: I have updated my answer here. I've implemented my own program based on it, and since I don't have a C compiler with me, I had to test it on a C++ compiler with some changes first. Could anything be said about it?
2
A: Ask for stream of character input and print number of uppercase/lowercase characters

Jamal It looks a little weird to have newlines between the function statement and body since they're associated with each other. If case_letters() is just supposed to print something at the end, it should return void, not int. main() isn't doing anything else after calling the function. Unformatted o...

 
0
Q: Leverage C++ Type Inference and basic Reflection library

glampertI've just finished my fist iteration on a type inference and basic reflection library for C++, which is part of a small game engine I'm writing on my spare time. It features type instantiation by name/id and runtime type inference for classes that register with the system. I'd appreciate to have ...

 
 
1 hour later…
5:33 AM
0
Q: Python: scraping thefreedictionary.com

Ricky WilsonScrape results from thefreedictionary.com #!/usr/bin/python from bs4 import BeautifulSoup as bs import re from requests import get def remove_non_ascii(text): return re.sub(r'[^\x00-\x7F]+', '', text) def get_soup(url): raw = remove_non_ascii(get(url).content) soup = bs(raw) ...

 
 
1 hour later…
6:47 AM
Code Review and Stack Overflow are down!
 
Someone must've tripped over a wire again...
 
7:34 AM
And we're back!
 
8:25 AM
0
Q: Can my Less CSS code be improved?

Kid DiamondI just started getting into the Less CSS framework and I am wondering if I'm doing it right and how the code can be improved if possible. global.less @themeRed: #cc1111; @themeColor: @themeRed; @marginBottom: 10px; @contentRadius: 5px; body { font: 12px Arial; color: #333; backgrou...

 
 
2 hours later…
10:12 AM
How do we call a problem linked to an error occuring near the beginning or the end of an array?
 
10:29 AM
@Morwenn {off by one,fencepost,bounds} error if it's related to the mishandling of indices
 
Bounds error. That's probably the word I was looking for. Thanks :)
4 answers and I still managed to find an error and an improvment to do in my parallel sieve.
 
11:09 AM
morning
 
11:38 AM
0
Q: Thoughts on how to optimize my Python code for Project Euler 27?

jshuafI decided to try simple brute force, and it worked surprisingly quickly. Here's my code: """Considering quadratics of the form: n^2 + an + b, where |a| < 1000 and |b| < 1000 Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes f...

 
12:06 PM
The room seems quite dead today :/
Do you all have a life besides CR?
 
0
Q: Any comments on my Python solution for Project Euler 28?

jshuafI realized that the spiral was essentially an arithmetic sequence, so I based my code off of that. Any suggestions would be greatly appreciated! from timeit import default_timer as timer start = timer() def spiral_diag_sum(n): if n < 1: return None elif n == 1: return 1 elif n % 2 =...

 
@StackExchange Thanks. I'm really glad that you are there for me.
 
Sorry @Morwenn, we do have lifes, yes. And sleep.
 
12:25 PM
Me too. But not today.
 
12:40 PM
I'm trying to figure out how I want my TCG/CCG to be... I want it very simple but there should be some tactics
Right now I'm thinking every card is a monster that has X attack and Y health, but I don't knwo where the tactic is then :D
 
Creating such a game is tough :)
I am still reworking on my parallel sieve of Eratosthenes. I am reading papers about data races, atomics and the C++11 memory model.
 
Sounds interesting aswell
Do you have any idea how to add somewhat more tactics to the game?
Because right now the only tactic is whom to attack pretty much, and keeping monsters longer in hand
(It needs to be simple such that I can still write an AI over it :p)
 
Use the system of "traps": cards that allow to react to an opponent attack. Try to make something that does not advantage only the bigger monsters.
 
I do remember Yu-Gi-Oh having cards in attack modus and in defense modus, where in defense you couldn't see them
I'm afraid traps make it quite complicated already from an AI perspective
 
For example, "prevent the damages from the attack, each attacking monster is dealt damages corresponding to its force".
 
12:45 PM
and it would require me to think
 
If you want simple traps, program "reactive" traps: traps that are automagically activated when a condition is met.
 
Could be interesting
 
That way, the AI does not have to think. It reacts.
 
I think having at least 2 modes for a card is also pretty vital for a decent tactical game?
 
The only thing it will have to choose is whether it wants to play monsters or traps from its hand.
2 modes?
 
12:47 PM
Offensive vs Defensive for example
 
That will make your AI quite complex.
 
I don't mind it having some form of complexity ^^
I think I need to think more about it
 
The problem with this challenge is that you need at think before you code.
 
yeah..
 
1:16 PM
0
Q: State Design Pattern in Python

Martin SchulzeI'm trying to find the best - read: readable, maintainable, robust, threadsafe, usable - solution for a State Machine in python. For this I've been looking at the State Design Pattern. However I want a pythonic and lean solution (saying not implementing functions in subclasses that are not needed...

 
Meh, need to finish this website for an uni project
 
Why is the need to think before coding a problem?
 
Because I'd like to start on creating a model for the game
 
Because the rules of the challenge are relaxed: you actually have to create a theorical cards game before coding it.
So you have to think about consistent rules. Which means that you really have to think before getting into the code.
 
Oh, this is for the challenge.
 
1:33 PM
Monking CRitters!
 
MonCRing!
(Ok, that's maybe too much)
 
monking @rolfl
 
0
Q: Raising error if method not overridden by sub-class

YatharthROCKBackground I have a base (only 2 classes inherit from it, and only from it) abstract (meaning I don't want it to be used directly) class that implements some common functionality. Some of it depends on certain methods being defined, methods whose implementation differs per the exact sub-class; ...

 
hi all
 
@Nobody Hi :)
 
1:45 PM
@StackExchange: Is this OT?
 
I am not sure.
 
@skiwi: Did you have something to say to me when you wrote:
17 hours ago, by skiwi
talk to you later @Nobody
@Morwenn: I just noticed it is actually a postcondition
 
@Nobody What's a postcondition?
 
a constraint that must hold after the function was executed (and for the output of the function)
something like: the returned vector contains all primes up to and including the input value
 
I mean in our context, what is supposed to be considered a postcondition? xD
I know what a postcondition is, but I don't know what is supposed to be one in your previous sentence.
 
1:52 PM
the constraint to the output of the function (especially the including part)
I was referring to your comment reply on the sieve answer
the inclusion of the boundary is not a precondition (as written in my comment) but a postcondition
 
Oh, ok.
 
How did this chatroom get the question feed embedded? I haven't seen it in others...
 
@YatharthROCK I don't know, but it's not the only chatroom. See The Bridge on Arqade for example. They even embed the blog updates feed.
 
@YatharthROCK: It is a bot
 
@Nobody i figured. An 'official' one?
@Mo
@Mor
 
1:56 PM
depends on how you look at it
 
How do you select a name for auto-completion?
 
I don't know who made it but it is not from an SE dev I believe
 
tab
 
@Morwenn: Thanks I did not know that :)
 
@Nobody I would assume you just have to tick a checkbox when creating a room.
 
1:57 PM
for the bot to appear?
 
Yeah.
 
I don't think so
maybe @rolfl knows?
 
@Morwenn Thanks. The idfference from the behaviour in nick-autocompletion in comments is jarring.
 
Devs could add an automated way to create a RSS bot though. It would be handy.
 
There's already an RSS feed; but I don't think it would be that fast.
 
1:58 PM
the bot isn't very fast either
I believe it is polling every 5 or 10minutes
 
Anyway, just popped in to check if people were active on the site. Posted for the first time here: codereview.stackexchange.com/questions/47059/…
 
Yeah, the bot is rather slow. It generally takes 2~5 minutes to post a new question here.
 
I think we lack some python devs here
I am not very experienced in python
 
I often used Python, but I am not expert in idiomatic Python.
Idiomatic Python: if you need something, there already exists a lib for it. Use it.
 
Probably, but I was just reinventing the wheel to learn.
 
2:02 PM
@YatharthROCK: Regarding your question: What happens if you don't have the functions defined and want to use them? There should be an error? Does your code deliver a better error?
 
A project I thought i could competed in hours is taking days.
 
@YatharthROCK I wasn't specifically talking about your question :)
 
Somthing I reckon wouldn't have happened if I had wirtten doctests aggresively and planned it extensively before wiritng.
@Morwenn and I was talking about your general advice with regard to my question :)
@Nobody Yeah, there should be an error.
 
I didn't even see that it was about a Matrix class :s
 
Althought in hind-sight, I realize that not implementing them would cause an error anyways as the mthods would hopelessly try to look for the missing ones.
 
2:04 PM
@YatharthROCK Room owners can link a feed (any number of rss feeds) to a room
 
@YatharthROCK: That is my point
 
@Nobody: Actually, I had some static methods in the top class which were named similarly to the methods in question; which is probably why I, in a frenzy, added those lines.
I agree that I should just let the missing methods error uot naturally.
 
@rolfl: Take that 🍌
 
LOL, I guess talking to other people does help a lot.
 
yeah, or rubberducking :)
 
2:07 PM
/me is googling for that term...
 
It is a good term
....
Rubber duck debugging, rubber ducking, and the rubber duckie test are informal terms used in software engineering to refer to a method of debugging code. The name is a reference to a story in the book The Pragmatic Programmer in which a programmer would carry around a rubber duck and debug his code by forcing himself to explain it, line-by-line, to the duck. Many programmers have had the experience of explaining a programming problem to someone else, possibly even to someone who knows nothing about programming, and then hitting upon the solution in the process of explaining the problem. I...
 
(BTW lmgtfy.com is a better way to post a link for someone laxy.)
Definitely. I think I'll go and talk to my poor ol' unused VGA monitor now. Bye!
 
@Nobody How long did it take for you to find the banana unicode ;-)
 
~20s
I just googled it, unfortunately it does not display in my browsers
its just a box with numbers in it
does it display correctly for you @rolfl?
 
Of course ;-)
 
2:17 PM
did you know it already?
 
I have encountered it when looking for musical notes ... yes
Never thought to use it in here.
I expect it will become popular
 
I just got a box (Chrome on Ubuntu). I wonder if it's my font...
 
user image
2
 
the site I got it from lists only 4 fonts that support it (of which one does only give another "not supported" logo)
@rolfl: It looks like the one from Segoe UI
@rolfl: Which settings do you use to get this to display?
 
No idea .... just works
 
2:25 PM
which browser is it then?
 
FireFox
 
then it might be the operating system, I am using FF too
 
Seems that the second version of my parallel sieve of Eratosthenes is ready :)
Aaaaaand I may have found a bug in clang.
 
2:41 PM
which version?
 
3.5
 
Well, that is not yet stable, I believe. What is the bug?
 
It seems that std::vector<T>(std::size_t count) somehow copies some T values while no copy should be made.
 
depending on your installation that might be an error of the glibcxx
 
It complained when I wrote std::vector<std::atomic<bool>> is_prime(45u);. It told me that std::atomic<bool>(const std::atomic<bool>&) was deleted.
Which is normal since the constructor is indeed deleted.
However, it should never have used the copy constructor.
 
2:44 PM
where does the error get triggered?
 
I'll try to provide a minimal test case.
It works fine with g++.
 
And, what a morning ....
I need to go shopping
new clothes.
 
@Morwenn: I can reproduce it
well, I am away for a bit
see you later
 
Ok :)
 
So, lost 35 lb, and another 25 to go .... half-way wardrobe .... I am trying to lose more lb's than I gain k's of rep.
5
 
2:51 PM
If I lose 35 lb...
 
a leg?
 
88 lb left.
 
You need to eat more ;-)
 
Nope, I'm small.
1m64.
 
no kidding....
I'm 1m82
but was a prop on the rugby field, and in the heavy-weight rowing crew at university
 
2:53 PM
I've almost been the smallest guy, wherever I went to.
 
I was strong, and fit, and muscle, 102kg when I was at my fittest.
 
o____o
 
That was 20 years ago ;-)
Now I am back below 100kg. for the first time since I was 20.
 
I felt the best when I was around 52~53 kg. Now it's more lire 55~57 kg.
 
And, I am ou of here.
 
2:55 PM
Bye :)
 
3:30 PM
0
Q: Check if XmlNode with certain attribute exists and create XmlNode if not

JoelI'm not going to explain the purpose of the code provided below. If you do not understand it, i know that i have to improve it (naming, structure etc.). I would like to know how to improve this code in terms of readability and complexity. Data structure: <?xml version="1.0" encoding="utf-8"?> <...

0
Q: Parallel sieve of Eratosthenes, version 2

MorwennThis question is a revision of Parallel sieve of Eratosthenes. The goal is to implement a sieve of Eratosthenes with parallel strikes out from the boolean array. I tried to fix the data races and all the threading-related errors as well as to add some of the ideas from the previous thread. Now, t...

 
oo you posted something @Morwenn
 
It's not the first time.
 
I know, let's read it
 
Why are you surprised? xD
 
Because questions from the chatroom are not thát common
 
3:33 PM
It's true that the general question/answer ratio of the chatroom is quite low.
 
Which is not surprising in essence
 
Yours is different :p
 
Is a parallel version that hard? I mean Sieve of Eratosthenes doesn't seem to be that difficult
 
I've never written any threaded code before. At least, not explicitely threaded.
 
I see
I should really work on my homework now
 
3:37 PM
Hehe :D
 
It's quite simple, I'm comparing two movies, and need to add some background if one's data is 'better' as the others
like running time for example
The longer one should be green, other red imo
wow, netbeans for HTML5 dev has an inbuilt color chooser in css styles
Pretty neat
This coding is so not on my level, but cba to learn javascript better right now for this assignment
function compareMovies() {
    var movieOne = numberToString(1);
    var movieTwo = numberToString(2);
    if (parseInt($("movie" + movieOne + "Year").html()) > parseInt($("movie" + movieTwo + "year").html())) {
        $("movie" + movieOne + "Year").removeClass("negative").addClass("positive");
        $("movie" + movieTwo + "Year").removeClass("positive").addClass("negative");
    }
    else if (parseInt($("movie" + movieOne + "Year").html()) < parseInt($("movie" + movieTwo + "year").html())) {
Need to get done with it asap and then not look at it again
And there's some typos even I see
 
3:53 PM
0
Q: Using model view presenter (MVP) in C# code

ChathurIm a beginner to Model-View-Presenter pattern and Im finding a way to use it in a sample application In my C# winforms application has a Employee Class and it has properties like EmployeeID,Name, Address, Designation etc. Also it has behaviors like viewEmployee(), AddNewEmployee(), PromoteEmploy...

 
speaking of JavaScript, the other day I played this "meta-JavaScript adventure game" alexnisnevich.github.io/untrusted -- a lot of fun
 
:o interesting idea popped up for CCG
But need to work it out :P
 
0
Q: Generic radix sort

iavrThis is my first question! It started out with my answer to Radix Sort on an Array of Strings?. Since I intend to write a generic radix sort for my own purposes anyway, I continued a little bit, and here is a version tested on: a fixed std::array of unsigned numbers, each treated as a fixed se...

 
re
 
welcome back
Should a CCG contain any more randomness than a shuffled deck?
 
4:19 PM
Having issues with internet at my house, @rob0t will be offline for some time.
@Jamal There are some things you could simplify, the valid_char() method could just contain return (!isdigit(ch)).
Using that would also get rid of the need for including the <stdbool.h> header.
 
@Morwenn: I noticed that the error I get is another
my clang is complaining about a deleted operator= for atomic
 
@Nobody Yes, that's what I was talking about.
 
but you said it was the copy constructor
 
That means that the constructor of std::vector<std::atomic<T>> is trying to call the copy constructor of std::atomic<T>.
 
@Jamal Also, the & in the parameters won't compile for me. Get rid of all of them and it compiles fine.
 
4:25 PM
but my compiler chokes on:
 
This particular overload of the constructor should never call the copy constructor.
 
*__first = __tmp;
and complains about the copy assignment being deleted
 
But this is in the implementation of std::vector's constructor.
 
for me the error is deeply hidden inside the function __fill_n_a
 
The standard guarantees that this constructor should not do any copy.
 
4:27 PM
7 levels deeper than the constructor
 
It's also the error get. But that means that they call a function that they should never have called in the constructor.
 
I find the constructor sane
it calls _M_default_initialize
which calls std::__uninitialized_default_n_a
 
Yay, I think I've got my CCG draft up
 
which goes through some overloads
the last of which calls std::fill_n
which I think is wrong
because fill does a copy
while uninitialized_default sounds as if everything is default constructed
 
I think that std::__uninitialized_default_n_a should not call std::fill_n.
 
4:31 PM
exactly that is my view
so it is not the vector's fault
and, as I said, the problem is in the glibcxx (at least in my place) which gets used by clang
it is odd, that gcc does not produce the same error
 
If clang produces the error and not gcc, that probably means that the error comes from libc++.
 
wait a moment
uninitialized_default_n_1 is a selected specialization for __is_trivial(_ValueType)
but atomic should not be trivial
the non trivial overload does in fact construct all objects
 
0
Q: Project Euler 14: Longest Collatz Sequence in c++

TwooeyI've brute forced solve Project Euler 14. This is my first attempt at trying to solve it, by caching already solved answers, and skipping them as I run it, I ham finding the program take's almost twice as long as the simple brute force method of checking each number. I could also use some insigh...

 
4:55 PM
@Nobody I'm too lazy to submit a bug report :(
 
I would like to dig deeper but I can't seem to find the definition of __is_trivial
 
It's generally a compiler intrinsic.
 
1
Q: My first PHP project and I'd appreciate any feedback

ianI'm very much on the beginner end of the PHP scale but I have read plenty of the entry level books and completed the online training at teamtreehouse.com so I know the basics. I'm at a point where I've built a tax calculator in PHP (UK income tax) and it works and is accurate but I have no clue ...

 
it seems atomic inherits the __is_trivial value from its template parameter
under clang
oh, atomic is only allowed for trivial types ...
 
5:13 PM
Yep.
 
anyways this:
static_assert(!__is_trivial(std::atomic<int>), "Atomic must not be trivial");
triggers under clang but not under gcc
 
Strange again xD
 
it highlights the root cause
I found some other code that suffers from the same problem I think
wow I really missed out on python lately:
2
A: Python class design

Martin SchulzeI'm not sure what you're intending to do with this class so I can only offer some general tips. Make private variables private: def __init__(self, url): self._url = url Use properties instead of get_ methods. For example: @property def request(self): return self._requests.get(self._u...

I don't know about properties and abc.ABCMeta
 
Properties are eally cool and I don't know much about abstract base classes.
 
5:37 PM
0
Q: Kinect for Windows gesture application C#

Brian JThis is my first solo project as part of my college course and I'm not sure about the quality of my code. Could someone take a quick review of this class to suggest improvements or practices I should be incorporating into my coding? I tried to tidy up the code by dividing it up into regions and ...

 
@Nobody good idea bout the blog
 
I thought I already posted that somewhere
but obviously I just dreamed about it :-)
 
I bet @Nobody would have thought of that.
 
@rolfl I would have loved to upvote "Celtic metal" :/
 
std::vector in C++ is indexable syntax-wise like array indexing?
Or can that be done with any class as a operator[]?
 
5:48 PM
Any class that defines an operator[] can be indexed like an array.
 
Sounds pretty cool
I think I've got my CCG idea together
 
Overloading the operators is great for expressivity. Unless you overload them to add some unintuitive features.
 
In a CCG, is it neccessary that the best most powerful monsters need to be weak at some point to maintain balance? Or would it be completely fine to have a few very powerful monsters around
 
Shrek... the musical!!! Whoo hoo. Got to turn off the phone
 
0
Q: Parse Bloomberg Excel/CSV with Pandas DataFrame (New User)

user3529051First, please pardon my ignorance. This is my very first Python program. Also, please forgive the cross-posting. I was advised to post again here. I retrieved Bloomberg data using the Excel API. In the typical fashion, the first row contains tickers in every fourth column, and the second ro...

 
6:04 PM
Does anyone happen to know the Java concensus on value-based classes vs subclasses? For the CCG I'm going to design a class called `Card`, and it there exist two sub-identities, namely a monster card and a fusion card.
Should it be an enum value or a subclass?
I guess it's applicable to all OOP languages actually
 
I'd rather not use the enum
 
What about deciding what to do with a certain type of card? Should they still have some public enum available so you can resort to switch-statements over ugly instance-of if-else-blocks.. I think the latter might be worth it
 
can you name an example?
I think this can be handled by a double dispatch visitor
 
6:21 PM
Don't have a full example yet unfortunately
well I think I got one
Suppose you have a Deck where you can draw a Card. At start of the turn the player draws a card. All you have is a Card card.
Well hm I don't even know if such an usecase exists
but you assume you want different actions on it being a MonsterCard or a FusionCard.
 
which can be solved by double dispatch
 
Could you show a simple example?
 
Sorry can only do C++:
class CardVisitor;

class Card {
virtual void beVisited(const CardVisitor&);
};

class MonsterCard : Card {
void beVisited(const CardVisitor &cardVisitor) {
cardVisitor.visitedCard(*this);
}
};

class FusionCard: Card {
void beVisited(const CardVisitor &cardVisitor) {
cardVisitor.visitedCard(*this);
}
};

class CardVisitor {
virtual void visitedCard(const MonsterCard&);
virtual void visitedCard(const FusionCard&);
};
now you would subclass CardVisitor and implement the visitedCard for the specific type
and later call:
card.beVisited(subclassedCardVisitorInstance)
 
As goal to provide less coupling?
 
partly
the main goal is to be fully type aware
 
6:32 PM
I'll keep it in mind, I'll come back onto it in the coming days once I visit something that is a concrete use case
 
without having to check explicitly
 
I see, casting is something I dislike
gotta be afk a bit now
 
I am off as well
see you another day
 
@syb0rg: Okay, I figured it out. I have to pass pointers, not references. Yet something else about C that I've learned.
 
00:00 - 19:0019:00 - 00:00

« first day (344 days earlier)      last day (3681 days later) »