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
std::vector<int> a = { 3, 1, 4, 4, 2 }; | |
std::vector<int> res6 = lift(a) | |
.zipWithIndex() | |
.filter( []( const std::pair<int, size_t>& v ) { return v.second > 0; } ) | |
.map( []( const std::pair<int, size_t>& v ) { return v.first; } ) | |
.toVec(); | |
BOOST_CHECK_EQUAL( res6.size(), 4 ); | |
CHECK_SAME_ELEMENTS( res6, std::vector<int> { 1, 4, 4, 2 } ); |
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
trait FrontendRoutes extends ScalatraServlet with ScalateSupport { | |
val db: Database | |
get("/") { | |
contentType="text/html" | |
ssp("/index") | |
} | |
get("/matches") { | |
db withSession { | |
val q3 = for { |
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
import org.eclipse.jetty.server.Server | |
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler} | |
import org.eclipse.jetty.webapp.WebAppContext | |
import org.scalatra.servlet.ScalatraListener | |
object JettyLauncher { // this is my entry object as specified in sbt project definition | |
def main(args: Array[String]) { | |
val port = if(System.getenv("PORT") != null) System.getenv("PORT").toInt else 8080 | |
val server = new Server(port) |
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
This is also a test. |
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 <memory> | |
class A | |
{ | |
public: | |
A( std::unique_ptr< int > v ) : m_v( std::move(v) ) {} | |
std::unique_ptr< int > m_v; | |
}; |
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
$ g++ -std=c++11 -g -fPIC ptr.cpp -o ptr | |
ptr.cpp: In constructor ‘A::A(std::unique_ptr<int>)’: | |
ptr.cpp:6:44: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = int; _Dp = std::default_delete<int>]’ | |
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/memory:86:0, | |
from ptr.cpp:1: | |
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/bits/unique_ptr.h:256:7: error: declared here | |
ptr.cpp: In function ‘int main(int, char**)’: | |
ptr.cpp:14:12: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = int; _Dp = std::default_delete<int>]’ | |
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/memory:86:0, | |
from ptr.cpp:1: |
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 <memory> | |
class A | |
{ | |
public: | |
A( std::unique_ptr< int > v ) : m_v( v ) {} | |
std::unique_ptr< int > m_v; | |
}; |
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
const double* b_p = &(B.data()[0]); | |
double* w_p = &(W.data()[0]); | |
typedef double v2df __attribute__ ((vector_size (16))); | |
for( uint32 i = 0; i < rows; i++ ) //For each row | |
{ | |
double* w_p_row = w_p; | |
double dp = 0; | |
/* Loop over 400 elements |
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
const double* b_p = &(B.data()[0]); | |
double* w_p = &(W.data()[0]); | |
for( uint32 i = 0; i < rows; i++ ) //For each row | |
{ | |
double* w_p_row = w_p; | |
double dp = 0; | |
/* Loop over 400 elements | |
* Sum into sum |
NewerOlder