This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T, reified U> mapBuilder() = MapBuilder(T::class.java, U::class.java) | |
class MapBuilder<T, U>( | |
private val tClass: Class<T>, | |
private val uClass: Class<U> | |
) { | |
operator fun invoke(arg: Any): MapBuilder<T, U> { | |
when { | |
tClass.isAssignableFrom(arg.javaClass) -> { | |
// you got a T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package funWithIoC | |
import com.nhaarman.mockitokotlin2.anyVararg | |
import hwdtech.ioc.* | |
import org.junit.Test | |
import org.mockito.Mockito | |
import java.lang.AssertionError | |
import kotlin.test.* | |
class HelloTest { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package funWithIoC | |
import hwdtech.ioc.* | |
import org.junit.Test | |
import org.mockito.Mockito | |
import java.lang.AssertionError | |
import kotlin.test.* | |
class HelloTest { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
class Max | |
{ | |
public: | |
double operator()(double a, double b) { | |
return a >= b ? a : b; | |
} | |
}; | |
template <class T, class F> class BinderTwoOne |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. | |
# User-specific files | |
*.suo | |
*.user | |
*.userosscache | |
*.sln.docstates | |
# User-specific files (MonoDevelop/Xamarin Studio) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. | |
# User-specific files | |
*.suo | |
*.user | |
*.userosscache | |
*.sln.docstates | |
# User-specific files (MonoDevelop/Xamarin Studio) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <bitset> | |
int main() | |
{ | |
std::string binary = std::bitset<8>(128).to_string(); //to binary | |
std::cout<<binary<<"\n"; | |
unsigned long decimal = std::bitset<8>(binary).to_ulong(); | |
std::cout<<decimal<<"\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct It | |
{ | |
Matrix *matrix; | |
size_t row; | |
size_t col; | |
}; | |
It *begin (Matrix *matrix) | |
{ | |
It* it = new It(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Complex.cpp | |
#include <iostream> | |
#include "Complex.h" | |
using std::cout; | |
using std::endl; | |
/** | |
* Creates a new Complex with default values for real and imaginary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "CppUnitTest.h" | |
#include <iostream> | |
using namespace Microsoft::VisualStudio::CppUnitTestFramework; | |
namespace UnitTest2 | |
{ | |
TEST_CLASS(UnitTest1) | |
{ |
NewerOlder