I'm trying to insert a number into my vector "heapvect." I keep changing from references and pointers and it still won't allow me to pass in num into the vector. I have made this without template and making a dynamic array (constructor/destructor), I'm unsure if having a vector and template made me think differently of the whole heap sort.  I tried having pointers for heapvect and getheapvect.  //main.cpp #include"heap.h" #include&lt;iostream&gt; #include&lt;vector&gt; using namespace std; int main() {     int size;     int num;     cout &lt;&lt; "USER:" &lt;&lt; endl;     cout &lt;&lt; "Enter size for heap: " &lt;&lt; endl;     cin &gt;&gt; size;     heap&lt;class T&gt; yeet;      cout &lt;&lt; "Enter in " &lt;&lt; size &lt;&lt; " of items:" &lt;&lt; endl;     for (int i = 0; i &lt; size; i++) {         cin &gt;&gt; num;         yeet.getheapvect().push_back(num);     }     system("pause");     return 0; }    //heap.cpp #include "heap.h" template&lt;class T&gt; heap&lt;T&gt;::heap() { } template&lt;class T&gt; heap&lt;T&gt;::heap(int size) {     getheapvect().resize(size*2); } template&lt;class T&gt; heap&lt;T&gt;::~heap() { } template&lt;class T&gt; void heap&lt;T&gt;::insertin(const T item) {     getheapvect().push_back(item);     int index = distance(getheapvect().begin(), item);     while (index != 0 &amp;&amp; getheapvect()[parent(index)] &gt; getheapvect()[index]) {         swap(getheapvect[index], getheapvect()[parent(index)]);         index = parent(index);     } } template&lt;class T&gt; void heap&lt;T&gt;::minheap(int size, int index) {     int large = index;     int left = (2 * index) + 1;     int right = (2 * index) + 2;      if (left &lt; size &amp;&amp; getheapvect()[left]&gt;getheapvect()[large])         large = left;     if (right &lt; size &amp;&amp; getheapvect()[right]&gt;getheapvect()[large])         large = right;     if (large != index) {         swap(getheapvect()[index], getheapvect()[large]);         makeheap(size, large);     } } template&lt;class T&gt; void heap&lt;T&gt;::heapsort(int size) {     for (int i = (size / 2) - 1; i &gt;= 0; i--)         makeheap(size, i);     for (int i = size - 1; i &gt;= 0; i--) {         swap(getheapvect()[0], getheapvect()[i]);         makeheap(i, 0);     } } template&lt;class T&gt; void heap&lt;T&gt;::print(int size) {     for (int i = 0; i &lt; size; i++)         cout &lt;&lt; getheapvect()[i] &lt;&lt; ' ';     cout &lt;&lt; endl; } template&lt;class T&gt; void heap&lt;T&gt;::PRINT() {     print(getheapvect().size()); } template&lt;class T&gt; void heap&lt;T&gt;::swap(T  a, T  b) {     T temp = a;     a = b;     b = temp; }    //heap.h #ifndef HEAP_H #define HEAP_H #include&lt;iostream&gt; #include&lt;vector&gt; using namespace std;  template&lt;class T&gt; class heap { private:     vector&lt;T&gt; heapvect;     void print(int size); public:     heap();     heap(int size);     ~heap();     void insertin(const T item);     void minheap(int size, int index);     void heapsort(int size);     void PRINT();     void swap(T a, T b);     int parent(int i) { return ((i - 1) / 2); };     int leftchild(int i) { return ((2 * i) + 1); };     int rightchild(int i) { return ((2 * i) + 2); };     vector&lt;T&gt;&amp; getheapvect(){ return heapvect; }; }; #endif    Output is supposed to bring out a sorted vector in ascending order.
Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)
What is the name of this Ubuntu program? A couple month ago I installed a bunch of clipboard manager programs in Ubuntu, tried them out and then removed them. I must have missed one of these and now it keeps bug me in my daily usage. I need some help to identify the name of this program because the program itself provides very limited information.  This clipboard program has below characteristics: 1. It occupies hotkey Ctrl+;. When I press this hotkey, the clipboard history will pop out. It happens in bash, Chrome, Eclipse IDE, and etc, wherever it is text inputable. This is kind of annoying because it overrides my other hotkeys inside these applications. 2. Very laconic UI. Like below picture, with only a line "Select to paste", then listing out the clipboard history. There is no program information whatsoever. Right clicking on it and no menu are shown at all.      So far I have tried below ways to identify this program: 1. Browse system monitor for processes with names that could be correlated. 2. Browse through my installation log (dpkg.log) to find my installation history. Without luck, the log is lost. But I was not successful. MS word: a macro to turn ON/OFF some proofing settings What macro could turn ON/OFF some proofing settings? (Unfortunately macro recording doesn't record the setting change)  I'm looking for a way to turn ON/OFF 2 proofing settings (at the same time):    check spelling as you type mark grammar errors as you type Distribution of Dark Matter around galaxies It is well-known that measurements of the velocity profile in galaxies are not compatible with Newtonian laws. A way to circumvent the problem is to assume that galaxies are surrounded by a spherical halo of Dark Matter. The density of mass of this Dark Matter can then be computed from the velocity profile with Newton's laws.   My question is the following: the formation of a galaxy involves essentially only the gravitational interaction. According to Newton (and General Relativity too), the trajectory of a particle does not depend on its mass. As a consequence, I do not understand how usual matter and Dark Matter could have followed different trajectories leading to such different mass distributions nowadays. Can somebody explain this (apparent) paradox ? Given Ohm's law, how can current increase if voltage increases, given fixed resistance? According to Ohm's law, $V=IR$ (voltage equals current times resistance).  So if the voltage increases, then the current increases provided that the resistance remains constant.  I know that Voltage or potential difference means work done per unit positive charge in bringing that charge from one point to another.  So according to Ohm's law, if the work done per unit charge increases then current will increase. How can this be true? Point out my mistakes. Polynomial contrasts for regression I cannot understand the usage of polynomial contrasts in regression fitting. In particular, I am referring to an encoding used by R in order to express an interval variable (ordinal variable with equally spaced levels), described at .  In the example of , if I understood correctly, R fits a model for an interval variable, returning some coefficients which weights its linear, quadratic, or cubic trend. Hence, the fitted model should be:  $${\rm write} = 52.7870 + 14.2587X - 0.9680X^2 - 0.1554X^3,$$  where $X$ should take values $1$, $2$, $3$, or $4$ according to the different level of the interval variable.  Is this correct? And, if so, what was the purpose of polynomial contrasts? Is Innate Spellcasting counterspellable? On p.85 of Xanathar’s Guide to Everything, there’s a section clarifying that you need to perceive a spell being cast (by either a verbal, somatic or material component) in order to counterspell it.  It then goes on saying this :     If the need for a spell’s components has been removed by a special ability, such as the sorcerer’s Subtle Spell feature or the Innate Spellcasting trait possessed by many creatures, the casting of the spell is imperceptible.   The thing is that many monsters’ Innate spellcasting specify that only material components are discarded (not verbal or somatic). So I am not sure whether you can actually counterspell innate spellcasting when the stat block only mentions removing material components.  There seems to be  supporting that such spells could be counterspelled (although it is confusing a bit).  It basically comes down to whether the above quote’s “many creatures” refers to all creatures with innate spellcasting, or only those that forgo all spell components to innanely cast. So, which is it ? How to obtain Hamiltonian formalism and phase space for Lagrangian with second-derivatives? I am confused by the orientation of a topological manifold. My understanding is: An orientation of a topological manifold is a choice of generator of the $H^n(M,\mathbb Z)$. So given a manifold, we could have 2 orientation defined on the manifold. For $\mathbb{CP}^2$ on orientation is determined by the complex structure, the other orientation is denoted by $\overline{\mathbb{CP}}^2$. And it is well known that there is no orientation reversing map from $\mathbb{CP}^2$ to itself.  My question is: are they homeomorphic? I guess they are not homeomorphic. But I am confuesed, doesn't the orientations defined on the same manifold, how come after reversing the orientation they become not homeomorphic? Two rotating discs with same angular momentum when brought in contact completely stop. Why is the angular momentum not conserved in this case? Two discs mounted on different thin, lightweight rods oriented through their centres are made to rotate about their axes seperately such that the angular momentum of the two about their respective axes is same in both magnitude and direction. When both are brought in contact, they stop due to force of friction. Why is the angular momentum not conserved about their axes in this case?(Was positive before contact, but zero after the process completes, no external force present either) Book: Handful of children kept in a school as political mythological prisoners I have multiple cameras in a scene. What I want to do is to change which one is active. This way I can view the scene from different angles. How would I do this? Don't count non-printing characters, HTML comments or other content not displayed toward minimum character requirements A follow-up to , and an extension of .   shows that it is possible to circumvent minimum character requirements using null bytes.  Can we exclude such non-printing characters as ASCII NULL and other control characters from counting toward minimum character requirements?  Edit: Users have demonstrated that , unmatched or invalid HTML tags, and other content that is not displayed after Markdown parsing can be used to bypass such requirements as well.  Can we cover this case as well, except for links? What's the proof that the Euler totient function is multiplicative? That is,     why is $\varphi(AB)=\varphi(A)\varphi(B)$, if $A$ and $B$ are two coprime positive integers?   It's not just a technical trouble—I can't see why this should be, intuitively: I bellyfeel that its multiplicativity should be an approximation at most. And why the minimum value for $\varphi (n)$ should be $ \frac{4n}{15} $ completely passes me by. How do I automate a key press in AppleScript? A finite $p$-group cannot be simple unless it has order $p$ I am to trying to prove this theorem: A finite $p$-group cannot be simple unless it has order $p$.  I have this:   Let $G = P$ and $|G|=p$; then there exists $N$, a normal subgroup of $G$ by Lagrange's theorem, such that $|N| \mid |G|$ so, $|N|= |e| = 1$ or $|N| =  p$  If $|N|=p$ so $N=G$.  But I don't know how I can prove the part in the case of $|N|=|e| = 1$  Is my start correct? What can I do to increase battery life on my Android device? What can I do to get better battery life on my Droid? Battery life seems awful. Less than 15 hours or so on normal usage. How do I identify the C terminal on my HVAC? How do I identify the C terminal on an HVAC, furnace, or boiler? If the terminals don't have a screw labeled C what should I look for on the wiring diagram? What steps should I take if a wiring diagram cannot be found or if it indicates that a C terminal doesn't exist?  Note: This is an extension to  which asks about running the wires through the wall. This question is about where to connect the wire at the HVAC. What are the differences between consumer grade SSDs and the much more expensive enterprise SSDs? I am in need of a terabyte or so of storage space for Lucene indices on a testing server.  I'm having a hard time differentiating between disks like the  for about $450 vs  of dollars.  What concerns should I have regarding the 840 evo, and what should I be looking for?  This server will be used strictly for in-house testing purposes by our development team and will have to put up with periodic load testing. How to make table split in two pages I am writing a paper using the elsarticle document class. However, the article contains a long table which is sent to the next page, in the middle of the page although I have specified the position as 'here'. Is there any way to make the table split if one page is not long enough for the table? Thank you very much for your very kind help. Determining bare earth DEM from unclassified LAS file? I have data in LAS format with RGB values created from aerial photogrammetry using a UAV. I am  trying to find a solution to extract the bare earth DEM from the point cloud.   I have tried SAGA, Fusion, MCC-LIDAR, but it is seems they need the LAS file to be already classified (which it naturally isn't). Can anyone point me in the right direction with a brief explanation of the process?   Generally, I would need to process about 100 mill points at a time (can tile them if needed).