Search Results

Search found 9134 results on 366 pages for 'variadic functions'.

Page 20/366 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • boost.asio's socket's recieve/send functions are bad?

    - by the_drow
    Data may be read from or written to a connected TCP socket using the receive(), async_receive(), send() or async_send() member functions. However, as these could result in short writes or reads, an application will typically use the following operations instead: read(), async_read(), write() and async_write(). I don't really understand that remark as read(), async_read(), write() and async_write() can also end up in short writes or reads, right? Why are those functions not the same? Should I use them at all? Can someone clarify that remark for me?

    Read the article

  • Problem with variable argument function in C++

    - by Freezerburn
    I'm trying to create a variable length function (obviously, heh) in C++, and what I have right now works, but only for the first argument. If someone could please let me know how to get this working with all the arguments that are passed, I would really appreciate it. Code: void udStaticObject::accept( udObjectVisitor *visitor, ... ) { va_list marker; udObjectVisitor *i = visitor; va_start( marker, visitor ); while( 1 ) { i->visit_staticObject( this ); //the if here will always go to the break immediately, allowing only //one argument to be used if( ( i = va_arg( marker, udObjectVisitor* ) ) ) break; } va_end( marker ); } Based on my past posts, and any help posts I make in general, there is probably some information that I did not provide that you will need to know to help. I apologize in advance if I forgot anything, and please let me know what you need to know so I can provide the information.

    Read the article

  • Problem with default member functions of class in C++ (constructor, destructor, operator=, copy cons

    - by Narek
    We know that compiler generates some member functions for user-defined class if that member functions are not defined but used, isn't it. So I have this kind of code: class AA { }; void main() { AA a; AA b(a); a = b; } This code works fine. I mean no compiler error. But the following code.... class AA { int member1; int member2; }; But this code gives an run time error, because variable "a" is used without being iniltialized!!! So my question is this: when we instantiate an int, it has a value. So why the default constructer doesn't work and by using those two int numbers initializes variable "a"??

    Read the article

  • Linkage of namespace functions

    - by user144182
    I have a couple of methods declared at the namespace level within a header for a class: // MyClass.h namespace network { int Method1(double d); int Method2(double d); class MyClass { //... } } then defined in //MyClass.cpp int Method1(double d) { ... } int Method2(double d) { ... } This project compiles cleanly and is a dependency for a ui project which uses MyClass. The functions were previously member functions of MyClass, but were moved to namespace since it was more appropriate. My problem is the ui project complains when it gets to the linker: 1network.lib(MyClass.obj) : error LNK2001: unresolved external symbol "int __cdecl network::Method1(double)" (?INT@ds@sim@@YAHN@Z) 1network.lib(MyClass.obj) : error LNK2001: unresolved external symbol "int __cdecl network::Method2(double)" (?CINT@ds@sim@@YAHN@Z) What am I doing wrong?

    Read the article

  • OBject access from different functions in VC++

    - by sijith
    Hi, I have 3 function in my class B. These three function have to access member function of other class A. I did this by creating object of class A in class B constructor and tried to access that object in functions of class B. But its showing error. How can i assess the same object in these three functions. Where i have to create object of class A B::B() { A a; } B:: function() { a.fun(); //fun belongs to class A } B:: function1() { a.fun1(); //fun1 belongs to class A } I am getting error, How can i implement the same where i can access object a in both function.

    Read the article

  • javascript: what are immediate functions used for [duplicate]

    - by tkoomzaaskz
    This question already has an answer here: Why using self executing function in JavaScript? [duplicate] 4 answers I've been programming in JS since some time, but I have never came upon a need of using immediate functions, for example: (function(){ console.log('hello, I am an immediate function'); }()) What would be the difference if I just wrote: console.log('hello, I am an immediate function'); ? I don't have any access to this function anyway (it is not assigned anywhere). I think (but I'm not sure) that I can implement everything without immediate functions - so why do people use it?

    Read the article

  • list all functions on CRAN

    - by baptiste
    Suppose I'm trying to run a script of unknown origin, and one of the functions is from a package that is not loaded by the script (an oversight, maybe it was loaded in the .Rprofile of the person who wrote it). How can I find in which package this function resides? There's some information compiled on CRAN, that doesn't require the user to download/install all R packages locally; however as far as I could tell it only gives access to the DESCRIPTION files. RSiteSearch, and its web equivalent, seem to access an online database of all CRAN packages, where presumably a list of all functions would be available. Is there some way of accessing this information? Thanks. Edit: I know sos::findFn, utils::RSiteSearch and search.r-project; what I would like is to get the raw data that these tools use.

    Read the article

  • Single C++/CLI method to wrap many type specific C functions

    - by T33C
    I am wrapping a C library using C++/CLI so that the C library can be used easily from C# in a C#'ish way. Some of the functions in this library are for putting a value into a container. There are no generics in C so there exists a function per type CLIB_SetBool(BOOL value), CLIB_SetInt(int value), CLIB_SetString(char* string) and so on. To make it easier to use from C#, I have created a single Set function which takes a System::Object. I have two related questions: With my method how would you use a switch statement on the type of System::Object to call the correct CLIB_Setxxxx function. [typeid is only for unmanaged code and I can't seem to use GetType.] Is there a better way to wrap these functions like using a Generic? [I started using template specialisation but then realised that C# doesn't see templates.] Thanks.

    Read the article

  • PHP: Classes to use functions from each other?

    - by Martti Laine
    Hello I've been into this problem for a while already, and have asked some questions about it here Stackoverflow. I've got some advice, but I just can't understand it. Could someone provide me an example of classes working smoothly together. I have 3 (maybe more) classes: mysql user alerts As I said, could someone provide an example, so these classes could use functions from each other class, e.g. user could use mysql's functions. I'm asking for an simple example, for learning-purposes. And please, no google-suggestions or links to other questions. I've tried to search this for a while already. No success, though. Martti Laine

    Read the article

  • const member functions can call const member functions only?

    - by Abhi
    Hi all. Do const member functions call only const member functions? class Transmitter{ const static string msg; mutable int size; public: void xmit() const{ size = compute(); cout<<msg; } private: int compute() const{return 5;} }; string const Transmitter::msg = "beep"; int main(){ Transmitter t; t.xmit(); return EXIT_SUCCESS; } If i dont make compute() a const, then the compiler complains. Is it because since a const member function is not allowed to modify members, it wont allow any calls to non-consts since it would mean that the const member function would be 'indirectly' modifying the data members?

    Read the article

  • Parameter pack argument consumption

    - by yuri kilochek
    It is possible to get the first element of the parameter pack like this template <typename... Elements> struct type_list { }; template <typename TypeList> struct type_list_first_element { }; template <typename FirstElement, typename... OtherElements> struct type_list_first_element<type_list<FirstElement, OtherElements...>> { typedef FirstElement type; }; int main() { typedef type_list<int, float, char> list; typedef type_list_first_element<list>::type element; return 0; } but not possible to similary get the last element like this template <typename... Elements> struct type_list { }; template <typename TypeList> struct type_list_last_element { }; template <typename LastElement, typename... OtherElements> struct type_list_last_element<type_list<OtherElements..., LastElement>> { typedef LastElement type; }; int main() { typedef type_list<int, float, char> list; typedef type_list_last_element<list>::type element; return 0; } with gcc 4.7.1 complaining: error: 'type' in 'struct type_list_last_element<type_list<int, float, char>>' does not name a type What paragraps from the standard describe this behaviour? It seems to me that template parameter packs are greedy in a sense that they consume all matching arguments, which in this case means that OtherElements consumes all three arguments (int, float and char) and then there is nothing left for LastElement so the compilation fails. Am i correct in the assumption? EDIT: To clarify: I am not asking how to extract the last element from the parameter pack, i know how to do that. What i actually want is to pick the pack apart from the back as opposed to the front, and as such recursing all the way to the back for each element would be ineffective. Apparentely reversing the sequence beforehand is the most sensible choice.

    Read the article

  • "Inlining" (kind of) functions at runtime in C

    - by fortran
    Hi, I was thinking about a typical problem that is very JIT-able, but hard to approach with raw C. The scenario is setting up a series of function pointers that are going to be "composed" (as in maths function composition) once at runtime and then called lots and lots of times. Doing it the obvious way involves many virtual calls, that are expensive, and if there are enough nested functions to fill the CPU branch prediction table completely, then the performance with drop considerably. In a language like Lisp, I could probably process the code and substitute the "virtual" call by the actual contents of the functions and then call compile to have an optimized version, but that seems very hacky and error prone to do in C, and using C is a requirement for this problem ;-) So, do you know if there's a standard, portable and safe way to achieve this in C? Cheers

    Read the article

  • Unrecognized libraries and functions

    - by John Smith
    I am working in Eclipse 3.7.2 on Ubuntu 12.04 with C++. I have read about a few instances where libraries were not being recognized and the majority said to update the Paths and Symbols but that hasn't fixed my issue. I have 2 projects open in my workspace, one of which is already a completed project that has implemented functions and libraries with no errors from Eclipse. However, when I try to implement some of the same functions or include the same libraries in the 2nd project Eclipse can't resolve them. For example, #include <string> #include <stdio.h> strstr(p, "<Project>"); The include statement will be accepted and stdio.h will be found but the strstr function is not resolved even though it works fine in the other project. Any ideas as to why this might be happening? Thanks.

    Read the article

  • Difference between jQuery click, bind, live, delegate & trigger functions( with example)

    - by I Like PHP
    Hello All, I know there are a lot of questions similar to this, but I want to know clear difference between all of these jQuery functions together on this page with an example, so that it will be very helpful for me to understand the mechanism of all of these functions. I have also read the reference on jQuery main site, but there is no comparison between these: $().click(fn) $().bind('click',fn) $().live('click',fn) $().delegate('td','click',fn) $().trigger('click') // UPDATED Please do not refer any link if there is a part of question belong to that. Please describe how all four function exactly works in different manner, and which should be preferred in which situation. Note: If there are any other function with same functionality/mechanism , then please share. Thanks a lot. Update i have also seen $(trigger) function? is this works similar to above four function ?

    Read the article

  • Parameter pack aware std::is_base_of()

    - by T. Carter
    Is there a possibility to have a static assertion whether a type provided as template argument implements all of the types listed in the parameter pack ie. a parameter pack aware std::is_base_of()? template <typename Type, typename... Requirements> class CommonBase { static_assert(is_base_of<Requirements..., Type>::value, "Invalid."); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ parameter pack aware version of std::is_base_of() public: template <typename T> T* as() { static_assert(std::is_base_of<Requirements..., T>::value, "Invalid."); return reinterpret_cast<T*>(this); } };

    Read the article

  • VLOOKUP and match functions appear to be searching the function rather than value

    - by Brandon S.
    Vlookup and match seem to be searching based on the function I have in my cell rather than the value i have in the cell. I have a column with dates, (ex: C2, which has the formula =E2&"/"&F2&"/"&D2 in them, for example). (where E2, F2, D2 are the year, month, and date). In another sheet and column, I have a bunch of dates, and i'm using the formula =VLOOKUP(C2,'sheet2'!A1:B252,2,FALSE), which doesn't work. (returns #N/A) If I replace C2 with the same date, but without the formula (just typing it in), VLOOKUP works. Why is this?

    Read the article

  • Run one virtual machine on a Linux server + standard Linux functions

    - by fistameeny
    Hi, I am looking for a method to setup a Linux server (running Ubuntu Server) that uses Samba for file sharing, as well as hosting a Windows virtual machine (in this case, Windows Small Business Server 2003, which in turn hosts SQL Server Express - Exchange won't be used on this). I would like to have the Linux server serving the files over Samba, and hosting the Virtual Machine. This obviously rules ESXi out as it couldn't do Samba at the same time. What would be the next best solution to give reasonable speed? Vmware Server 2.0, VirtualBox, Xen? There will be 10-15 users accessing the Samba shares and the SQL Express virtual machine. Matt

    Read the article

  • Compiling Ubuntu server: "libQtGui.so: undefined reference to png functions" errors

    - by Kowalikus
    I want to compile wkhtmltopdf on Ubuntu Server, but I have a problem with following errors: /usr/lib/libQtGui.so: undefined reference to `png_read_info@PNG12_0' /usr/lib/libQtGui.so: undefined reference to `png_set_gAMA@PNG12_0' /usr/lib/libQtGui.so: undefined reference to `png_set_PLTE@PNG12_0' ... /usr/lib/libQtGui.so: undefined reference to `png_create_info_struct@PNG12_0' /usr/lib/libQtGui.so: undefined reference to `png_set_bgr@PNG12_0' /usr/lib/libQtGui.so: undefined reference to `png_get_valid@PNG12_0' What can I do? in /usr/lib lrwxrwxrwx 1 17 2010-02-17 15:00 libQtGui.so -> libQtGui.so.4.5.2 lrwxrwxrwx 1 17 2010-02-17 14:59 libQtGui.so.4 -> libQtGui.so.4.5.2 lrwxrwxrwx 1 17 2010-02-17 14:59 libQtGui.so.4.5 -> libQtGui.so.4.5.2 -rw-r--r-- 1 10071604 2009-10-14 23:34 libQtGui.so.4.5.2

    Read the article

  • Moving LiveMeeting admin functions to a different window

    - by Rob Farley
    I run a user group, and often host LiveMeeting sessions. I use a projector, with a crowd watching. How do I do the admin stuff (respond to Q&A, etc) on one window, and just have the video on the 'extended monitor'? I dont' want the people in the audience to see anything except the video feed, but I want to be able to watch questions come in, etc... Note: I don't have a problem extending the screen across the two monitors - I already have different stuff showing on my screen compared to the projector. I just want a way to put the LM video on Monitor 2 (projector), and the LM controls on Monitor 1.

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >