int main() { Vector<int> v(15, 0); Vector<int> v2(17, 1); Vector<std::string> v3(1000000, "F**k"); Vector<std::string>* v5 = new Vector<std::string>(100000, "Damn"); assert(v[1] == 0); Vector<int> v12(15, 0); v = std::move(v2); assert(v.size() == 17); assert(v[0] == 1); assert(v3[0] == "F**k"); Vector<int> v6; v6 = v2; v2 = v12; delete v5; std::cout << "Meeh" << std::endl; Vector<std::string> v40(100, "Damn"); std::cout << "Moving" << std::endl; std::cout << "F**k" << std::endl; Vector<std::string> v41 = std::move(v40); std::cout << "Delete is the problem" << std::endl; auto begin = v41.begin(); auto end = v41.end(); while(begin != end) { std::cout << *begin << std::endl; ++begin; } Vector<std::string> v42; for(int i = 0; i < 200; ++i) { std::cout << "Pushed back: " << i << std::endl; v42.push_back("Shiit"); } v42.reset(); return 0; }
Real Pyramid5::volume () const { // The pyramid with a bilinear base has volume given by the // formula in: "Calculation of the Volume of a General Hexahedron // for Flow Predictions", AIAA Journal v.23, no.6, 1984, p.954- Node * node0 = this->get_node(0); Node * node1 = this->get_node(1); Node * node2 = this->get_node(2); Node * node3 = this->get_node(3); Node * node4 = this->get_node(4); // Construct Various edge and diagonal vectors Point v40 ( *node0 - *node4 ); Point v13 ( *node3 - *node1 ); Point v02 ( *node2 - *node0 ); Point v03 ( *node3 - *node0 ); Point v01 ( *node1 - *node0 ); // Finally, ready to return the volume! return (1./6.)*(v40*(v13.cross(v02))) + (1./12.)*(v02*(v01.cross(v03))); }