Questions tagged [construction]

Use for questions related to building a data structure, such as a heap.

Construction is a concept of Object-Oriented languages.

Objects need to be setup for use:

  • Their member variables need to be allocated
  • Any Object member variables also need to be constructed
  • The Object methods need to be setup for calling

This process is accomplished by construction.

112 questions
1
vote
2 answers

Constructing numpy array using tile

My question is: How can I get b from a using tile? a = np.array([[1,2,-6],[-4,5,6],[10,8,-1]]) b = np.array([ [[1,2,-6],[1,2,-6],[1,2,-6]], [[-4,5,6],[-4,5,6],[-4,5,6]], [[10,8,-1],[10,8,-1],[10,8,-1]] ]) I…
Academia
  • 3,984
  • 6
  • 32
  • 49
1
vote
2 answers

Delay true base class construction with placement new

I'm asking if (and why) the following approach is a) legal and b) moral. I'm asking with emphasis on C++03, but notes on C++11 are welcome, too. The idea is to prevent derived classes that could themselves be default constructible from implementing…
bitmask
  • 32,434
  • 14
  • 99
  • 159
1
vote
5 answers

In-explicit constructing in operator overloading?

Is it possible use in-explicit constructing with operators ? Just like in this example (which does of course not work): class myFoo { public: double x, y; myFoo(double, double); void operator [] (myFoo); }; int…
Niklas R
  • 16,299
  • 28
  • 108
  • 203
1
vote
3 answers

How do I initialize all elements of TrieNodes' children to null

I am trying to solve a Trie problem, for which I create a TrieNode class as below: class TrieNode { public: bool isWord; TrieNode* children[26]; TrieNode() { isWord=false; memset(children, NULL, sizeof(children)); …
Someone
  • 611
  • 4
  • 13
1
vote
1 answer

Haskell Converting paramaters into type

I have created the type Contact, and I'm trying to create a function that takes 4 parameters (First Name, Last Name, Phone and State) and creates a contact and adds it to a list of existing contact. type LastName = String type FirstName =…
JavaDumbell
  • 215
  • 2
  • 11
1
vote
4 answers

Deserialize a binary tree breadth-first in Functional Programming

I had an imperative program which deserializes to a Binary Tree from an array. Its a BFS algorithm. I was wondering how to do this in Scala with functional programming concepts. class TreeNode(_value: Int = 0, _left: TreeNode = null, _right:…
1
vote
2 answers

Is It Safe to Put a Java Enum in a Static Map During Its Construction Call?

As the title reads, I have the following Enum: public enum MyEnum { FIRST_ENUM("first enum"), SECOND_ENUM("second enum"), THIRD_ENUM("third enum"), FORTH_ENUM("forth enum"); private final String param; private static class Mapper { …
NuCradle
  • 665
  • 1
  • 9
  • 31
1
vote
1 answer

construction of bst from preorder traversal

While constructing Binary search tree from given Preorder traversal, can't we use normal method for construction of BST from set of array values instead of following the method given here. If not ,please give counter example where my approach fails.…
1
vote
3 answers

Constructing an object as part of ostream output

For a class declaration as below: class A{ public: A(int); ~A() private: int a; }; And a constructor definition as follows: A::A(int i){ a = i; cout << a << endl; } I would like to do something like this from main(): int main(){ int i; //user…
user9196120
  • 381
  • 3
  • 9
1
vote
2 answers

Cannot create class in AHK after destruction

I'm trying to wrap my head around classes in AHK. I'm C++ dev, so would like to make use of RAII (__New, __Delete), but it looks like I miss some concepts since things look very contra-intuitive for me. After some tries I came up with this simple…
Werolik
  • 923
  • 1
  • 9
  • 23
1
vote
2 answers

Construct ImmutableSortedSet without warnings

I want construct ImmutableSortedSet. I wrote code smt like: Set obj = new HashSet(); Comparator myComparator = new Comparator(){ @Override public int compare(String o1, String o2) { return 0; } …
Stan Kurilin
  • 15,614
  • 21
  • 81
  • 132
1
vote
2 answers

Cross source file template instantiation and use

I have a class with several template member functions that I would like to distribute among several source files to speed up compilation times. (The templates are implementation details and are not intended to be used outside the class, hence their…
fbrereto
  • 35,429
  • 19
  • 126
  • 178
1
vote
0 answers

Using library(element).function() or library.function() constructions in Javascript lib

We have Javascript library: (function (global, factory) { factory(global); }(window , function() { var MyLib = function(elem) { return new MyLib.foo.init(elem); } MyLib.foo = { init: function(elem) { elem = typeof…
user274288
  • 11
  • 1
  • 2
1
vote
1 answer

My desire: to continue to edit a redirected page

I'm building my first website from scratch and want to redirect all viewers (mainly the employer for appearances sake) to an "under construction" page. I used the following code in the head:
1
vote
1 answer

HTML Selected Value If Statement PHP

I'm planning on making a website that has a function like this: http://www.hwcompare.com/category/gpu/ And I can't get the code sorted out to display a picture, some text and some benchmarks I want based on the value the user has selected. HTML…