C++ explicit constructor that takes a pointer I've recently stumbled across an explicit constructor that receives a single pointer argument. I wonder if the explicit keyword is necessary in this case? as there is no constructor for a pointer so there cannot be any implicit conversion.  class Foo {  public:   explicit Foo(int* int_ptr); }
What does the explicit keyword mean? What does the explicit keyword mean in C++?
I came across a reference to it recently on  and (as of now) it is not explained.  I suspect  might be it, but I don't know for sure. Generate UML diagram from C# class Is "laic" an alternative word to the word "layperson"? How useful is that rule and how many times we can use that in one game?  Under what conditions can the en passant rule be used?  How often does it come up and is it a good idea to use it? I need to parse  strings like "2008-09-03T20:56:35.450686Z" into Python's datetime type.  I have found  in the Python standard library, but it is not very convenient.  What is the best way to do this? Avoid synchronized(this) in Java? Whenever a question pops up on SO about Java synchronization, some people are very eager to point out that synchronized(this) should be avoided. Instead, they claim, a lock on a private reference is to be preferred.  Some of the given reasons are:    (very popular this one, also has an "accidentally" variant)     Other people, including me, argue that synchronized(this) is an idiom that is used a lot (also in Java libraries), is safe and well understood. It should not be avoided because you have a bug and you don't have a clue of what is going on in your multithreaded program. In other words: if it is applicable, then use it.  I am interested in seeing some real-world examples (no foobar stuff) where avoiding a lock on this is preferable when synchronized(this) would also do the job.  Therefore: should you always avoid synchronized(this) and replace it with a lock on a private reference?      Some further info (updated as answers are given):   we are talking about instance synchronization both implicit (synchronized methods) and explicit form of synchronized(this) are considered if you quote Bloch or other authorities on the subject, don't leave out the parts you don't like (e.g. Effective Java, item on Thread Safety: Typically it is the lock on the instance itself, but there are exceptions.) if you need granularity in your locking other than synchronized(this) provides, then synchronized(this) is not applicable so that's not the issue How can I view the camera through an object as a material in Cycles? How to sort lines with >> double angle brackets? It seems that sort behaves strangely on lines such as &gt;&gt;b    $ cat test a &gt;&gt;b b c &gt; &gt;&gt;  $ sort test &gt; &gt;&gt; a b &gt;&gt;b c   I would expect the &gt;&gt;b line to be the third line output by sort but it is the fifth. Why does it do this and is there a way to make sort give my expected output?    I'm using GNU/Linux Ubuntu 16.04. More informative flagging history for comments Way to detect frozen video with ffmpeg? Is there a way to detect frozen video with ffmpeg? I only need to know if there are rather large regions of frozen video, say 10 seconds or more.   I'm familar with the  filter.   Maybe you could first difference adjacent frames, then use blackdetect to tell whether the difference has not changed? I'm not sure how to perform the difference though. Why is $\Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}$? Python mechanize javascript Does it make sense to say, "The speed of light varies?"  Some may say right off the bat "Yes, it changes as a wave passes through a different medium."  However, I'd like to say no, because when I hear someone say the speed of light, I always think of the constant $c$ (unless the medium is specified to not be a vacuum, but then it isn't $c$ anymore), not the speed of a particular wave.  To me, it makes more sense to say something like, "The speed of a particular wave varies." What is the correct way to state this in the professional world? And in general, when professional physicists say "the speed of light," are they referring to the constant or the actual speed of the wave? How did nobody at Hogwarts (especially Dumbledore) figure out what killed Myrtle? The information is all clearly there, since Harry and Ron, two 12-year-olds, were able to figure it out (with a bit of help from a petrified Hermione), thought at the time Aragog was much younger and smaller and wouldn't have been as easy to find, so maybe the "spiders flee before it" clue would have been lost, although to be honest it's not exactly as vital a piece of the puzzle as the others.  Dumbledore himself is obviously a very capable and intelligent Wizard, and after Myrtle died she came back as a ghost and was able to provide (admittedly limited) details of her own death.  I don't know about you, but I'd have thought at least someone would have tried to piece it together at the time, and it wouldn't have taken them long to figure out "Oh, she saw a pair of big yellow eyes after hearing a boy speak a funny language in the bathroom and dropped dead? Sounds like she might have heard somebody order a Basilisk to look her in the eyes in parseltongue", especially if the investigator in question was someone like Dumbledore.  Do we have any info on why nobody seemed to have found out anything in 50 years prior to Harry Potter (and, probably more importantly, Hermione Granger) turning up at Hogwarts? I improved an edit... but did I actually? I don't know how I did manage to do it.  I just ... Oh wait, did I do it actually? I actually simply approved it! You can see it . Apparently, I made no changes myself.  But now I'm struggling to understand how exactly was I able to do it, because in 79% of cases I am greeted with this message:        and in another 20%, this faked "improve" goes through (while I don't change completely anything) and I can haz a binding approval vote :D  And in other 1%,  it when I clicked improve (now I know ).  So it's definitely a bug, but I can't find the exact way of reproing.  Note: earlier there was actually a bug which allowed me to approve an edit by clicking improve and submitting with no changes, then it was fixed and for some time the message I've shown above stopped me constantly, and now there is another bug Why are date-based hats awarded too early? I just got the  hat which states "post or vote on December 21".  Does SE have a time machine now? Nielsen & Chuang Exercise 2.2 - “Matrix representations: example” Reproduced from Exercise 2.2 of Nielsen &amp; Chuang's Quantum Computation and Quantum Information (10th Anniversary Edition):     Suppose $V$ is a vector space with basis vectors $|0\rangle$ and $|1\rangle$, and $A$ is a linear operator from $V$ to $V$ such that $A|0\rangle = |1\rangle$ and $A|1\rangle = |0\rangle$. Give a matrix representation for $A$, with respect to the input basis $|0\rangle, |1\rangle$, and the output basis $|0\rangle, |1\rangle$. Find input and output bases which give rise to a different matrix representation of $A$.   Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book. Get index of each capture in a JavaScript regex How do I access $HOME/storage Termux directory on Android Pie with a GUI File Explorer?  In Termux I print the working directory with pwd and it shows $HOME/storage as:  /data/data/com.termux/files/home   My internal storage looks like this:  . ├── Alarms ├── Android |   ├──data |   |  ├── ... |   |  ├── com.termux |   |  |   └── files |   |  |       └── 0 items |   |  └── ... |   └── ... ├── DCIM ├── Download └── ...   My external storage looks like this:  . ├── Android |   ├──data |   |  ├── ... |   |  ├── com.termux |   |  |   └── files |   |  |       └── 0 items |   |  └── ... |   └── ... └── LOST.DIR   Neither my internal storage, nor my sd card, contain a /data/ directory at the root level. Where is this /data/ directory? For that matter, where is the root /storage/ directory? Where is the root /emulated/ directory? Where are any of these directories and why cant I access any of them? Number of ways to distribute 5 distinguishable balls between 3 kids such that each of them gets at least one ball How many ways are there to distribute 5 distinguishable balls between 3 kids such that each of them gets at least one ball?   My approach is $ \binom{5}{3} 3! $ + $ \binom{2}{2} \binom{3}{2}2!$ which is equal to $66$?