default-parameters Questions

1

Solved

I'm seeing some odd behaviour in a class I created a while ago, where it seems that a struct's properties are changing immediately after being passed (copied) to a method. I've boiled it down to a...
Mentor asked 20/4, 2015 at 20:22

4

Solved

Is the following code legal in C++? void f(void* = 0) {} int main() { f(); } Which page of the C++ standard states that this usage is legal?
Benghazi asked 3/2, 2013 at 18:41

3

Solved

I'm quite sure this is not possible, but if someway exists (maybe through compiler-provided macros), it would be very useful for me, so I am posting it here. Suppose I have a function: void func( ...
Angst asked 15/9, 2014 at 7:38

3

Solved

I want to write extension methods for converting a vector and matrix into string. I did this in the following way. For Vector public static string GetString<T>(this T[] SourceMatrix, string...
Hanafee asked 3/8, 2014 at 8:36

1

Solved

So I have gcc version 4.8.1, g++ version 4.6.4, using flags: -std=c++0x and -pthread. I simplified my problem down to the code shown and still get the original error. What I have below compiles, ...
Hagy asked 25/3, 2014 at 22:52

1

Solved

I have trouble understanding how default parameters interact with multiple clauses in named functions. It boils down to, why does the following snippet work? defmodule Lists do def sum([], total...
Latinize asked 27/2, 2014 at 21:22

1

Solved

I want to make a class that uses a strategy design pattern similar to this: class C: @staticmethod def default_concrete_strategy(): print("default") @staticmethod def other_concrete_strateg...

1

Solved

Really simple to replicate, the output is bizarre; Expected output is "bbb bbb" Actual output is "aaa bbb" Has anyone got any MSDN explanation of this behaviour? I couldn't find any. ((a)n...
Niels asked 17/12, 2013 at 12:20

5

Solved

I wrote a class which accepts a varargs as a parameter, and specify its default so that a user can often instantiate it without specifying a parameter: class MyClass(values: Int* = 42) { } Howev...
Bosk asked 20/8, 2013 at 7:10

2

How does C++ handle function pointers in relation to functions with defaulted parameters? If I have: void foo(int i, float f = 0.0f); void bar(int i, float f); void (*func_ptr1)(int); void (*f...

4

Solved

I'd like to know if this is possible in Delphi (or if there's a clean way around it): type TSomething = record X, Y : Integer; end; GetSomething( x, y ) -> Returns record with those values. ...
Captivate asked 20/9, 2010 at 10:55

1

Solved

Using the following ftp_download method works, but if I change ftp.getbinaryfile(file,localdir,1024) #=> Saves the file to localdir to ftp.getbinaryfile(file) #=> returns nil I get nil...
Gaynor asked 8/5, 2013 at 13:22

6

Solved

If DateTime is an object and default C# parameters can only be assigned compile-time constants, how do you provide default values for objects like DateTime? I am trying to initialize values ...
Dumond asked 24/5, 2010 at 3:11

4

Solved

Possible Duplicate: Nonstatic member as a default argument of a nonstatic member function Correct me if I am wrong, but the way I think default parameters work is this: When the comp...
Phonate asked 3/12, 2012 at 7:3

1

Using .NET 4, I am confused by the inability of the compiler to resolve the first method call in the sample below. using System; namespace MethodResolutionTest { class Program { static void Ma...
Intimidate asked 13/11, 2012 at 10:52

2

Solved

Scala-lang reference 5.5.1 and 6.6.1 gave me the impression that a default parameter would be able to refer to a previously evaluated one: class Test(val first: String, val second: String = first)...

4

Possible Duplicate: default value of parameter as result of instance method While it is possible to set default values to function parameters in python: def my_function(param_one='default'...
Nonesuch asked 2/11, 2012 at 13:16

1

Solved

I have a strange compilation warning for the following code, with Visual C++ 2010: #include <iostream> class test { public: template<class obj> class inner { private: // Line 11...
Piccadilly asked 29/9, 2012 at 20:29

3

Solved

I have this code: struct A{}; template<class T = A> struct B { void foo() {} }; B b; //Error: missing template arguments before 'b' //Error: expected ';' before 'b' //More errors ...
Strappado asked 27/6, 2012 at 16:57

3

Solved

Can someone explain why the result of the code below would be "class B::1" ? Why does the virtual method of derived class uses the default parameter of a base class and not his own? For me this i...
Cheroot asked 3/6, 2012 at 15:7

3

Solved

Today I was creating a default parameter value in a constructor. public SomeClass (String something = String.Empty) { // ... } The compiler complained. Default parameter value for "something...
Betteanne asked 30/5, 2012 at 22:55

2

Solved

Below is my code. public class PItem { public String content; public int count; public int fee; public int amount; public string description; // Default values public PItem(String _content...
Confirm asked 18/6, 2011 at 19:28

3

Solved

Possible Duplicate: Implementing a no-op std::ostream Is there any stream equivalent of NULL in c++? I want to write a function that takes in a stream if the user wants to have the in...
Lessielessing asked 5/6, 2011 at 4:8

2

Solved

I thought I could use named parameters after variable-length positional parameters in a function call in Python 2, but I get a SyntaxError when importing a python class. I'm writing with the follow...

2

Solved

I have the following class: template <typename Type = void> class AlignedMemory { public: AlignedMemory(size_t alignment, size_t size) : memptr_(0) { int iret(posix_memalign((void *...
Tonsillectomy asked 9/1, 2011 at 11:48

© 2022 - 2024 — McMap. All rights reserved.