Questions tagged [types]

Types, and type systems, are used to enforce levels of abstraction in programs.

types
Filter by
Sorted by
Tagged with
1 vote
1 answer
2k views

C++ functor (mapping)

I have created a class either<l, r> much like Haskell's Either a b. I have also implemented a function map directly in the class; this is what the code looks like: template<typename l, ...
Maarten's user avatar
  • 1,046
0 votes
1 answer
207 views

Scala class with covariance in derivable type of parameter

I want this typeclass: abstract class Model[U](val query: TableQuery[ModelTable[U]]) { // ... } But with covariance in the type of query. The idea is that I have functions that take an instance ...
A.J.Rouvoet's user avatar
  • 1,203
0 votes
2 answers
145 views

Django create new object based on current object type

I have a setup for a test with multiple question types (i.e., short answer, multiple choice). These tests can be created dynamically. What I am trying to do now is create a function to make the ...
Julia Ebert's user avatar
  • 1,593
1 vote
1 answer
58 views

XSD cutom type for fraction numbers with / symbol

Hi fellow programmers, I am trying to create custom XSD type extension to accept double or two doubles with "/" symbol in the middle. This way I want to express fraction numbers. For example: <...
Matas's user avatar
  • 840
0 votes
2 answers
64 views

Formatted string as datatype

I have a format for certain Ids and I'd rather have a custom datatype for them rather than store them as a string. How is this done in C#? Is this a good idea in the first place? An example below ...
user2279356's user avatar
8 votes
2 answers
550 views

create a Haskell type with finitely many inhabitants

According to “Haskell for a great good”, the type declaration for Bool is data Bool = True | False and that the type declaration for Int may be considered something like data Int = -2147483648 | -...
ziggurism's user avatar
  • 2,274
0 votes
1 answer
2k views

How can I declare variables to be of OpenGL's GLuint type in Eclipse for Android programs?

I'm using OpenGL ES 2.0. "GLES20.GLuint test_type;" gets an error: "GLES20.GLuint cannot be resolved to a type." I need variables of this type to refer to things like framebuffers, textures, and ...
Janin zah's user avatar
  • 201
5 votes
2 answers
164 views

How does Haskell infer correct type classes in MaybeT implementation?

How does Haskell know which is correct monad instance for each return expression? newtype MaybeT m a = MaybeT { runMaybeT :: m (Maybe a) } instance Monad m => Monad (MaybeT m) where return = ...
sevo's user avatar
  • 4,579
-1 votes
2 answers
663 views

c# - IEnumerator get type

I'm working with IEnumerator in C#. I don't know how can I get the current item's type. In the enumerator are not just int, string, etc. If You can, please give me an example too. Thanks!
GSeriousB's user avatar
6 votes
2 answers
20k views

What is datatype of FILE? [duplicate]

What is the data type of FILE in C or in other language? Is it an integer or structure or having no particular data type?
Munavar Fairooz's user avatar
13 votes
3 answers
1k views

Scala class extends {}

By chance I came across weird compiling Scala syntax: class Some extends { def hi = println("hi") } Guys: Is it an official Scala supported syntax? Does it mean simply extending the Object? Does ...
Max's user avatar
  • 1,795
0 votes
2 answers
169 views

C++: Something's wrong with my accumulator [duplicate]

I've been running this code but I have not been able to get an accumulation of doubled figures. #include <iostream> #include <vector> #include <numeric> using namespace std; int ...
coffeeFlow's user avatar
0 votes
1 answer
75 views

Composite c1 static data type interface implementation

I'm creating data types through C#. I would like to hav a base interface containing properties used by every C# created data types. But when implement the base interface the data type is gone from the ...
Johan's user avatar
  • 1
16 votes
4 answers
3k views

C++: "vector<int>::size_type variable" - what is the point of declaring in this way?

I think this is a very basic question but I couldn't just figure it out. I was used to using arrays in C++ but I'm now starting to learn vectors. I was making a test code, and I came across a ...
coffeeFlow's user avatar
1 vote
2 answers
16k views

op_Division and Data Types in powershell

Hi I am having a problem with some powershell I am using to detect screen resolution and then divide width by height. $width = (Get-WmiObject -Class Win32_VideoController).CurrentHorizontalResolution ...
d4rkcell's user avatar
  • 147
1 vote
2 answers
3k views

Parsing json by using Gson.fromJson() method into class< T > model is not working

My problem is, I can't parse json by using Gson.fromJson() method into class< T > model. In my PageOutput.java public class PageOutput<T> { @SerializedName("TotalItemCount") ...
felixwcf's user avatar
  • 2,087
1 vote
0 answers
268 views

"This is not a valid initialization expression" while using NULL() to initialize pointer

I've been trying to migrate a code that was written in the Fortran 90 language from Eclipse to Intel Visual Fortran and I'm having a lot of issues, one of which is the following: When I type this for ...
AnasElM's user avatar
  • 23
2 votes
1 answer
92 views

C++03: Is there a way to make a type that will compile to different types every time it is included in a template parameter?

I am trying to achieve something like this: typeof(vector<MyStrangeType>) != typeof(vector<MyStrangeType>) I.e. I want this type to produce a different type every time it is included as ...
GBleaney's user avatar
  • 2,146
2 votes
2 answers
267 views

Practical Difference Between Type and Class in Scala

What is practical difference between class person(val name: String, val weight: Int) and type person = (String,Int) ?
zunior's user avatar
  • 861
5 votes
1 answer
422 views

Why are Java wildcards more powerful than use-site variance?

I have read often that Java wildcards are a concept that is more powerful than the concept of use-site variance. But in my understanding, the concept of Java wildcards is exactly equal to the concept ...
gexicide's user avatar
  • 39.2k
0 votes
2 answers
3k views

C++ "typeid" error : operator not allowed in a constant expression

I am new to C++. I want to construct a class that holds the type information and the value of an object, and this is what I did: #include <typeinfo> enum My_Type { MyInteger = typeid(int); ...
user3794186's user avatar
2 votes
1 answer
315 views

When should .empty be used versus the singleton empty instance?

Working with collections in Scala, it's common to need to use the empty instance of the collection for a base case. Because the default empty instances extend the collection type class with a type ...
acjay's user avatar
  • 35.7k
1 vote
4 answers
246 views

C# Custom datatype with "choices"

I need a custom datatype for order status, how can this be done in C#? Below is an example of what I mean. Order can be in 4 states: - In queue - Handling - Shipping - Received class Order { ...
user2279356's user avatar
4 votes
4 answers
1k views

No clang warning or error, if C++11 lambda returns wrong type [duplicate]

it looks like my clang compiler (3.3) doesn't generate any errors, if the lambda's return type doesn't match: #include <functional> typedef std::function<void()> voidFunc; void foo(...
Sebastian Wagner's user avatar
-1 votes
1 answer
132 views

64 Digit Long Data Type in C++?

When converting 63 digit binary number to decimal number in Windows 7 calculator, how is the 63 digit binary stored in the calc program? I know the maximum equivalent value of 63 digit binary number ...
Grendizer's user avatar
  • 292
30 votes
4 answers
13k views

Can you specify type argument for None or tell compiler that it's an Option[String]?

I wonder if I can write something like this in my code: None[String]
jinglining's user avatar
0 votes
2 answers
685 views

Implementation of types, or abstraction ... Advantages and disadvantages

I was talking with my fellow Java programmers, and came across a novice question, polemic and perhaps even silly, which unfortunately confuse me. In order for my question becomes understandable, I'll ...
Loa's user avatar
  • 2,180
1 vote
1 answer
213 views

Differences between type definions and their meanings in typeid(equalizing)

unsigned int = unsigned int = signed int = signed signed long long int = singed long long = long long unsigned long long int = unsigned long long signed long int = signed long = long unsigned ...
Kitiara's user avatar
  • 401
3 votes
4 answers
1k views

error: classname does not name a type

I'm an intermediate student starting on pointers. I'm trying to store data in an array to be called by a search function later. When I try to compile, I am told "error: retail does not name a type" ...
Roark Burney's user avatar
0 votes
1 answer
3k views

Real data type fortran 90

A simple question. A similar question was there, but I did not get the exact one I am looking for. I was just checking the limits of real data type in fortran 90 (using ifort compiler), reason being ...
Vaidyanathan's user avatar
2 votes
1 answer
1k views

Java type mismatch, cannot convert to return itself as the generic type

It error's on the "return this;" line with this: Type mismatch: cannot convert from A to T. public class A<T extends A<T>>{ public T method() { return this; } } I don't ...
dammkewl's user avatar
  • 621
3 votes
2 answers
7k views

Vertical alignment is off on date type input

everyone I am using an HTML5 date type input in a web form. Here are the html blocks: <div><!--birthdate--> <label for="birthdate" class="col1">Birthdate: </label> &...
Newbian's user avatar
  • 35
3 votes
2 answers
2k views

Rails 4 - "No Implicit Conversion of Fixnum into String" - Error only occurs in production

I get the following error when running my Rails 4.1 project in production: ActionView::Template::Error (no implicit conversion of Fixnum into String): 8: %meta{content: "", name: "description"}/ ...
Ten Bitcomb's user avatar
  • 2,346
2 votes
2 answers
596 views

Is C#'s Decimal Type Accounting Safe?

I read that the Decimal type has a range of (-7.9 x 10^28 to 7.9 x 10^28) / (10^0 to 10^28) and that it is "appropriate for financial and monetary calculations." I can't seem to find a source that ...
Jonathan Mee's user avatar
  • 38.4k
7 votes
3 answers
222 views

Type checking with RankNTypes in Haskell

I'm trying to understand RankNTypes in Haskell and found this example: check :: Eq b => (forall a. [a] -> b) -> [c] -> [d] -> Bool check f l1 l2 = f l1 == f l2 (If my understanding is ...
beta's user avatar
  • 2,480
0 votes
2 answers
45 views

PIL processing - type error

I'm learning Python and I'm trying to get my head around the following in PIL. I was assuming that it was going to be straightforward but from the looks of it it ain't. So I'm loading an image, ...
dascomp's user avatar
-1 votes
1 answer
469 views

Catchall type for Golang API response

I am trying to define a struct that can hold an array of any type like so: type APIResonse struct { length int data []interface{} } I want the data property to be capable of holding an array ...
grep's user avatar
  • 3,996
1 vote
1 answer
44 views

Postgres FK declaration references customer name rather than type?

I don't use Postgres much (I used to use other DB's) so recently I was viewing a db in pgAdmin and saw an odd schema syntax which I can't find anything on the documentation and want to know a bit ...
iQ.'s user avatar
  • 3,903
-7 votes
1 answer
282 views

How do I achieve the equivalent of type shadowing by a derived class?

I would like to write something like the following: class A { virtual typedef int foo_t; void bar() { cout << "foo_t is " << get_demangled_name(typeid(foo_t)); } } ...
einpoklum's user avatar
  • 124k
0 votes
2 answers
664 views

cakePHP : Validation Type Date, but only use the Year

I use the date type in cakePHP, but the user only has to choose a year instead of the day-month-year. Code in the View: echo $this->Form->input('player_turnedPro', array( 'type' => '...
Gilko's user avatar
  • 2,350
7 votes
1 answer
2k views

Serialize/deserialize System.RuntimeType

I've got a List of Types that I need to save to file and read it after. I use DataContractSerializer but I get an exception during deserialization: Can't find constructor with arguments (...
Nick Tarasov's user avatar
0 votes
1 answer
202 views

VB.net 300 digits in a fraction - numeric data type

I'm looking for a numeric data type that can preserve up to 300 digits. I read that article and I tried double-single but they didn't work, I don't know why but it finishes at digit n25. Thanks Ex: I ...
user3047048's user avatar
0 votes
0 answers
410 views

Types of Mat in opencv

I have the following: Mat bladArray(Mat base) { std::vector<int> vec; for (int x = 0; x < base.cols; x++) { for (int y = 0; y < base.rows; y++) { vec.push_back(...
Thijser's user avatar
  • 2,673
-1 votes
1 answer
64 views

How to write one method in base class if method uses different types depending on the derived class?

The question sounds more complicated than it actually is. I have a simplified example below. Pink highlights indicate the differences between two classes. As you can see, the only real difference is ...
Doug's user avatar
  • 5,176
0 votes
1 answer
2k views

Jstree Valid_children between multiple trees

I currently have 2 jstrees both using the Types plugin in to define each node with a type. My problem is that when I drag one node from jstree #1, with type "Topic" to another tree jstree #2 with a ...
ReMaX's user avatar
  • 1
0 votes
2 answers
3k views

Oracle VARCHAR (15 BYTE) to MS SQL Server 2014 DATA TYPES

I am creating multiple tables in MS SQL SERVER 2014 to that will receive data from an Oracle server. Some of the data types that are coming over from Oracle are set to VARCHAR2 (15 BYTE), VARCHAR2(60 ...
Mr.Drew's user avatar
  • 31
7 votes
1 answer
553 views

How to move a subtree between trees in Haskell?

For two multi-way trees, t1 and t2, defined using type Forest a = [Tree a] data Tree a = Node { rootLabel :: a, subForest :: Forest a } how can I write a function that ...
Rich Ashworth's user avatar
0 votes
2 answers
494 views

C++ - Make a string+int set stl type

my question is: is it possible to create a multitype stl set? If a want to calculate the occurrences number from a text file, how can I do? I need to use only or ... #include <set> #include &...
user avatar
7 votes
1 answer
2k views

check if uint64_t is defined

The type uint64_t is not guaranteed to be defined on 32-bit platforms, and code like int main() { uint64_t i = 0; } may result in compilation errors of the type incomplete type. Is there a ...
Nico Schlömer's user avatar
0 votes
2 answers
2k views

Use from empty type parameters? [duplicate]

I was recently porting a Java 7 project down to Java 6 and I a had some Arraylists being initialized with empty type parameters. Of course it gave quite a few errors because of it only being ...
user avatar

1
393 394
395
396 397
579