Why do type alias templates use ‘using’ instead of ‘typedef’ in their syntax?

Here is what Bjarne Stroustrup says about why they introduced using instead of extending typedef: The keyword using is used to get a linear notation “name followed by what it refers to.” We tried with the conventional and convoluted typedef solution, but never managed to get a complete and coherent solution until we settled on … Read more

C++11: Why is private member template accessible outside class?

This is definitely a compiler bug, and actually one that has been known for quite some time: GCC #47346 (first reported in Jan 2011) and Clang #15914 (first reported May 2013). Your __tklass is clearly private, and the template alias is not marked friend, so this should be a simple access error. The simplest reproduction … Read more

“using” function

Starting Scala 2.13, the standard library provides a dedicated resource management utility: Using. More specifically, the Using#Manager can be used when dealing with several resources. In our case, we can manage different resources such as your PrintWriter or BufferedReader as they both implement AutoCloseable, in order to read and write from a file to another … Read more

Why do type aliases in C++ use ‘using’ instead of ‘typedef’ in their syntax?

Here is what Bjarne Stroustrup says about why they introduced using instead of extending typedef: The keyword using is used to get a linear notation “name followed by what it refers to.” We tried with the conventional and convoluted typedef solution, but never managed to get a complete and coherent solution until we settled on … Read more

using statement FileStream and / or StreamReader – Visual Studio 2012 Warnings

The following is how Microsoft recommends doing it. It is long and bulky, but safe: FileStream fs = null; try { fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); using (TextReader tr= new StreamReader(fs)) { fs = null; // Code here } } finally { if (fs != null) fs.Dispose(); } This method will always ensure … Read more

Manually destroy C# objects

You don’t manually destroy .Net objects. That’s what being a managed environment is all about. In fact, if the object is actually reachable, meaning you have a reference you can use to tell the GC which object you want to destroy, collecting that object will be impossible. The GC will never collect any object that’s … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)