Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
145 views

Suppose I'm implementing the function returning an std::optional<T>. In that function, I compute some condition, and then want to return either a value, or a nullopt. I can do it like so: std::...
einpoklum's user avatar
  • 139k
0 votes
0 answers
56 views

My code is below: class GrandParent { public: GrandParent() {} virtual ~GrandParent() {} int grandparent_data = 100; }; class Parent1 : virtual public GrandParent { public: Parent1() {}...
xxllxx666's user avatar
  • 383
1 vote
2 answers
84 views

I have the following class definitions. I would like to create an Alphabet of Letter classes where each Letter class is constructed using an argument from the parameter pack passed to the Alphabet ...
pic32cpp's user avatar
0 votes
1 answer
154 views

I am trying to represent assembly programs in Coq and compile them into a sequence of bytes. I have an assembly language, a decoder, a compiler, and proof that the decoder is the inverse of the ...
ixb's user avatar
  • 72
2 votes
2 answers
72 views

I have a function whose name parameter I want to provide tab completion for, the tab completion values are file names found in c:\temp. On top of using the files in c:\temp as values, I also want to ...
Ralf_Reddings's user avatar
-1 votes
1 answer
136 views

Guys I have been working on this problem since morning (4 hours ago) and still couldn't find a proper answer. How can I set the Subsets with these conditions? So for example an A Set is a subset of A2 ...
Game of HB - YT's user avatar
0 votes
1 answer
47 views

We are keen to have 3D model overlay on Google map and handle the click event so show the graphs viz temperature and pressure realtime data. Also, the issues reported by the system to be notified to ...
Lakshmi Rani's user avatar
0 votes
1 answer
90 views

If I'm constructing a non-trivial container like a custom map for example, and want to share code between the emplace and insert functions, one approach would be to have the insert function simply ...
metamorphosis's user avatar
0 votes
0 answers
106 views

Hi developers!I'm using Dart for flutter. I'm trying to figure out why the code below doesn't need 'late' or 'final' for its variables. I know what these terms mean, but I'm puzzled about when and ...
Devin's user avatar
  • 1
2 votes
1 answer
107 views

If I expect a string with space separated ints from user input (number of expected int's known), I can transfer it in haskell Data.Vector like this: main = do n <- readLn -- this is number ...
Evg's user avatar
  • 3,090
3 votes
2 answers
958 views

I am learning C++ using the books listed here. Now I came across the following statement from C++ Primer: When we allocate a block of memory, we often plan to construct objects in that memory as ...
user avatar
1 vote
3 answers
364 views

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; ...
Someone's user avatar
  • 653
8 votes
2 answers
309 views

In C++, object constructors cannot be const-qualified. But - can the constructor of an object of class A know whether it's constructing a const A or a non-const A? Motivated by a fine point in the ...
einpoklum's user avatar
  • 139k
9 votes
1 answer
2k views

How to in-place construct an optional aggregate? It seems I can only construct an optional single thing, and not an optional aggregate of things. #include <optional> #include <iostream> ...
user2394284's user avatar
  • 6,186
0 votes
0 answers
97 views

i'm using woocommerce to create a store for my shop in WordPress but whenever I activate the woocommerce plugin the page redirect with this message "ERR_TOO_MANY_REDIRECTS", then when I ...
Freweini Beyene's user avatar
0 votes
0 answers
48 views

i want to make a rescheduling model. I have 2 modes in tuple, I declare it using ID, I want to make a constraint if the costprod * duration in present's mode in day 1-7 <= earn value than choose ...
Beta's user avatar
  • 1
0 votes
1 answer
142 views

I want to make objective function to minimize impact due to the difference progress with schedule plan because the real progress was late. and I want make it some with the plan minimize the external ...
Beta's user avatar
  • 1
1 vote
1 answer
55 views

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. ...
JavaDumbell's user avatar
0 votes
2 answers
127 views

I want to make, if total production task "i" * duration at day 15 <= not equal to our target then choose alternative 2,else choose alternative 1. I made the data on tuple. but I still ...
Beta's user avatar
  • 1
0 votes
2 answers
266 views

I want to make if the earn value is not same with the plan then choose alternative 2, if same then choose alternative 1. I used tuple mode to determine the 2 alternative in OPL using CP(constraint ...
Beta's user avatar
  • 1
0 votes
1 answer
310 views

This was the list given: (4 (7 22) "art" ("math" (8) 99) 100) but I'm still having trouble coming up with the correct code in order to answer this problem all I have come up with ...
user14525426's user avatar
6 votes
2 answers
243 views

In my understanding the following are identical: Person p{}; // Case 1 Person p = {}; // Case 1.5 I noticed Person p = Person{}; // Case 2 produces the same tracing output as the Case 1 and Case 1.5 ...
Display Name's user avatar
  • 15.2k
3 votes
4 answers
801 views

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(...
JDev's user avatar
  • 461
7 votes
3 answers
3k views

I recently started using Haskell and it will probably be for a short while. Just being asked to use it to better understand functional programming for a class I am taking at Uni. Now I have a slight ...
JDMukiibs's user avatar
1 vote
2 answers
10k views

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 ...
NuCradle's user avatar
  • 725
0 votes
1 answer
51 views

I have a variety of objects created from template class bar (below). Each object has a data member with different data type (eg std::string, bool, int, etc.) I have a set of current defaults of each ...
SMGreenfield's user avatar
  • 1,728
0 votes
4 answers
352 views

I write a program to check the init process of class creation, and found calling the constructor multiple times changed the member pointer address. Look at following snippet. #include <iostream>...
Jiancong's user avatar
-1 votes
1 answer
51 views

Consider the following code: class SomeClass: def __init__(self): self.foo = None some_list = [SomeClass()] * 5 The problem with this code is that all 5 items of some_list refer to the ...
Serge Rogatch's user avatar
0 votes
1 answer
55 views

I build a VRP solution based on optaplanner 7.4.1. using a default construction heuristic "FIRST_FIT_DECREASING". In the ConstructionHeuristicDecider I can see now, that at the end of method ...
Frank Ehrhoff's user avatar
0 votes
1 answer
356 views

I am trying to refactor some legacy code. The task here is to construct lengthy messages/strings based on some pre-defined template that looks like this: field1,8,String filed2,5,Integer field3,12,...
Hua's user avatar
  • 756
0 votes
2 answers
258 views

I came across a large pod struct, in which I wanted to add a std::vector member. struct LargePodStruct { float x,y,z; int *arr; int sz; ... // dozens of primitive types ...
Grim Fandango's user avatar
1 vote
1 answer
172 views

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 ,...
csai's user avatar
  • 11
-7 votes
3 answers
55 views

private final EventManager eventManager; private final DateManager dateManager; private final UserManager userManager; What is the name of this construction? Is this object or something else? ...
Vilmantė Buožytė's user avatar
1 vote
3 answers
84 views

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 ...
user9196120's user avatar
1 vote
2 answers
240 views

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 ...
Werolik's user avatar
  • 965
0 votes
0 answers
25 views

In a Python class I wrote the following method: class user(): address_list = [] def __init__(self): self.address_list.append("a") When I use it as this: ur1 = user() ur1....
Grant Huang's user avatar
0 votes
3 answers
82 views

First of all I have following class: public class Pair <K, V> { public K key; public V value; public Pair (K key, V value){ this.key = key; this.value = value; }} and an interface: ...
Mikhail Dedyukhin's user avatar
0 votes
1 answer
43 views

I have a basic issue about the symbolic style programs in tensorflow, below are codes ( tensorflow 0.12 ): import numpy as np import tensorflow as tf import sys x = tf.placeholder(tf.float32, 1) y = ...
Paul 's user avatar
  • 21
5 votes
3 answers
3k views

Consider the following C++ class: struct Point { int x; int y; explicit Point() =default; // 1 explicit Point(int x_, int y_): x(x_), y(y_) { } // 2 }; The second constructor is ...
Francis Xavier's user avatar
0 votes
0 answers
455 views

I am using SLSQP function in NLOPTR for portfolio construction using 34 low volatility stocks. The stocks are not important. What I am trying to do is being able to impose a minimum weight and a ...
Nicholas Olds's user avatar
0 votes
0 answers
789 views

I am trying to create some words construction using custom template, for example I need something like this: and I don't really know best way to doing this, I want to create labels rotate and place it ...
Eugene's user avatar
  • 155
4 votes
2 answers
336 views

Often seen that examples of using STL algorithms are illustrated with list-initialized containers like: std::vector< int > v{1, 2, 3, 4}; But when this approach is used for (heavyweight) ...
Tomilov Anatoliy's user avatar
6 votes
2 answers
482 views

I'm working with the following (simplified) factory design to create objects of some inheritance hierarchy, shouldn't be anything special: // class to create class Class { public: Class(Type type, ...
user1709708's user avatar
  • 1,587
0 votes
1 answer
2k views

I'm guessing it's an error with the initiation/construction, but the parameters seem to be the correct ones and I can't find any other issues. Here's the entire activity code. The text to speech ...
user avatar
0 votes
1 answer
471 views

The construct new URL(new URL(new URL("http://localhost:4567"), "abc"), "def") produces (imho incorrectly) this url: http://localhost:4567/def While the construct new URL(new URL(new URL("http://...
George's user avatar
  • 7,713
2 votes
1 answer
3k views

Using oracle java 1.8.0_25 I have the following construct URL url = new URL(new URL(new URL("http://localhost:4567/"), "123"), "asd") According the documentation in ...
George's user avatar
  • 7,713
10 votes
2 answers
338 views

Shouldn't the temporary A(3) be destroyed before "Here" gets printed? #include <iostream> struct A { int a; A() { std::cout << "A()" << std::endl; } A(int a) : a(a) { ...
François-Marie Arouet's user avatar
1 vote
0 answers
159 views

We have Javascript library: (function (global, factory) { factory(global); }(window , function() { var MyLib = function(elem) { return new MyLib.foo.init(elem); } MyLib.foo = { ...
user274288's user avatar
0 votes
2 answers
182 views

I have a vector idx = [3; 5; 3; 4; 3; 2; 5; 1]. The number is from 1:k with k = 5. I want to make a "k by m" matrix A (m is the number of elements in the vector idx). Each row of A contains either '0' ...
HappyCoding's user avatar
1 vote
1 answer
27 views

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: <meta ...
Erik Coonce's user avatar