FAQ Database Discussion Community


What is inline data in a class?

c++,inline,class-design
In his talk about Designing value classes for modern C++, Marc Mutz mentions the concept of inline data (in the 6th slide, when talking about thin abstractions). I searched for what does that mean, but couldn't find anything close to a definition of what inline data is (even in the...

Proper way to split declaration and definition of inlined non member operator (linker issue)

c++,visual-studio-2013,linker,inline,operator-keyword
I have a visual studio solution with 2 projects, one of which is a static library. In this library I have the following class with some overloaded operators (both members and not): namespace Vec { class Vec2 { ... inline Vec2& operator +=(const Vec2& b); }; inline Vec2 operator+(const Vec2&a,...

HTML, CSS: Append inline-element to the right of a centered inline-element

html,css,center,inline
(The title might sound stupid but I don't know how to put it more sophisticated.) As you can see in the follwing screenshots, I have 3 stacked divs. <div class="col-xs-3"> <div class="center-horizontal-inline"> <a class="upvote" href="#" data-id="iZheLNnewWtMhPTQd"> </div> <div class="score"> 115 <span class="badge score-diff vertical-align"> +5 </span> </div> <div class="center-horizontal-inline"> </div>...

Is it legal to for a function declared “inline” to be recursive?

c,recursion,segmentation-fault,inline,language-lawyer
I was thinking a little bit about the C programming language and started to wonder how inline interacts with recursion. I made this test program to find out. static inline void f(void) { f(); } int main(void) { f(); return 0; } I compile the program using gcc and get...

Inline-block containers do not sit site by side, cause expansion of container

css,inline,grid-layout
Apologies, I have attempted to create a JS Fiddle replication, but the issue does not seem to occur in the JS Fiddle so I can only think it is a problem with the more general CSS on the page. The JS Fiddle created does not show the error, but here...

Does GCC merge files compiled together?

gcc,inline
Let's say that you have prog.c that includes lib.h, whose functions are defined in lib.c, and you build the program with ̀gcc -O3 lib.c prog.c. Does GCC merge both source files before compiling them? Is GCC able to inline short functions of lib.c into the resulting binary? Summary of answers...

Child div not inlining inside parent div

html,css,css-float,inline,division
I must be doing something stupid or looking over something obvious, because no matter what I do I cannot get these three divs inline inside this parent. .stats { display: inline-block; margin-right: 6px; float: right; padding: 0; font-family: "Roboto" sans-serif; color: black; } .separator { background: rgba(47, 187, 255, 0);...

Aligning form fields using CSS

css,forms,drupal,alignment,inline
I have an advanced search form (click "Advanced search") here in Dupal 7 - http://www.ibuild.ph/mtf-rdp-minimal/search/node and contact form here - http://www.ibuild.ph/mtf-rdp-minimal/contact. The search fields are inline, while the contact fields are positioned below the labels. Is there a way to inline position the fields with the text labels and make...

Creating a function alias

c++,c++11,inline,stdbind
EDIT: This question was originally titled "Using std::bind to create inline function," but that's not really what I'm after: I just want a simple way to alias functions. I would like to expose std::chrono::high_resolution_clock::now as a standalone function. That is, I would like to do the following: auto current_time =...

Django - Use class as inline in both parent and parent of parent

django,django-admin,inline,models
I have three class in my code. Exam, Question and QuestionResource. QuestionResource is a file and has a foreign key to Question.Also Question has a foreign key to Exam. Currently Question is included as inline in Exam's admin view. However it is seperately registered in the admin so I can...

Does inline function and Fzero can be used to solve nonlinear equations in which other parameters entered are user defined?

matlab,inline
I want to solve an equation in matlab for value Ql for this I have given command: f=inline('Ql^2 + Ql/(1+x((Q4*Ql)/(Q4+Ql))+ y)*(x +(x*(1+z)/(Q4*Ql)^2) /(1+(x*Q4*Ql*z)/((Q4+Ql)*(1+y)+ x*Q4*Ql)))'); g = fzero(f,0); where Q4 is computed based on parameters taken from user and x y z are direct inputs from user, my problem is that...

how to limit the queryset of an inline model in django admin

python,django,inline,django-queryset,django-admin-filters
I have two models implemented like class A(models.Model): a_name = models.CharField(max_length=50) class B(models.Model): a = models.ForeignKey(A) b_tag = models.CharField(max_length=50) user=models.ForeignKey(User) # stores username now i define a A admin and register it with B as a subclass to TabularInline.I wonder if it is possible somehow to filter the list of...

How to improve inline function efficiency?

c++,performance,optimization,inline
I profiled my code and found that one inline function takes about 8% of the samples. The function is to convert matrix subscripts to indices. It is quite like the matlab function sub2ind. inline int sub2ind(const int sub_height, const int sub_width, const int width) { return sub_height * width +...

Inline function at -O0 causes link failure in clang [duplicate]

c,optimization,clang,inline,c99
This question already has an answer here: Is “inline” without “static” or “extern” ever useful in C99? 3 answers I'm trying to compile the following code with clang at various optimization levels: #include <stdio.h> inline int foo() { return 42; } int main() { printf("%d\n", foo()); } At -O1,...

inlining when function body has no return statement

c,return,inline
I read that compiler may not perform inlining when "return" statement does not exist in function body and also in the case where return type is other than void. If it's like inlining cannot happen with functions that return anything other than void, why it needed a "return" statement for...

Inline class method in the header file

c++,optimization,inline
Is there any differece between the following implementations? class Foo { int bar(int x) const { return x * 2; } }; class Foo { inline int bar(int x) const { return x * 2; } }; ...

Content editable inline div moves when empty

html,css,html5,alignment,inline
Here is an example: http://jsfiddle.net/nojv18wf/ <div> <div class="display">Blah blah blah?</div> <div class="input" contenteditable="true"></div> </div> <br /><br /><br /><br /> <div> <div class="display">Blah blah blah?</div> <div class="input border" contenteditable="true"></div> </div> Watch where the caret goes when you click on "blah blah blah." In the first example, it jumps to before the...

Embedding image in Outlook 2013

html,image,email,outlook,inline
I need to be able to send an image in the signature line through HTML files. However, it can not come from a webserver because the receiver of the mail will have a delay while downloading the image from the net. Please help...

Align Text Inside A Inline-Block Div? CSS

css,css3,block,inline,text-alignment
I am trying to align a group of text, including p and h5 html elements. I am using inline-block display type to get the text to be on the same line for the titles. If the aligning with this display type is not possible it would be helpful if you...

Loop unrolling in inlined functions in C

c,optimization,inline,icc
I have a question about C compiler optimization and when/how loops in inline functions are unrolled. I am developing a numerical code which does something like the example below. Basically, my_for() would compute some kind of stencil and call op() to do something with the data in my_type *arg for...

Inlining inside a class

c++,inline
I have a templated class where most methods are defined inside the class so they can be inlined. In the following example, I show a copy constructor, but it could be anything. template <typename T> class Vector { private: ... public: Vector(const Vector& v) { if (condition) { call_1(...); }...

Setting a float/double to a constant value in AT&T inline assembly

c++,c,gcc,assembly,inline
I'm looking at increasing the runtime performance of a C++ library that I have written and profiled. I'm very new to assembly (and inline assembly) and have a very basic question to ask. How do I set the value of an xmm register (xmm, ymm, zmm, etc) to a constant...

Factoring parameter-independent code out of templates

c++,templates,inline
This question refers to Item 44 in the Effective C++ book. Scott Mayers points out that the following template class might incur code bloat since the invert function doesn't necessarily depends on the template parameter n. Unfortunately multiple template instances with different n values, such as SquareMatrix<int, 5> and SquareMatrix<int,...

Insert inline assembly expressions using Llvm pass

assembly,insert,llvm,inline
I am trying to create and append inline assembly expressions using an llvm pass. I am aware that I can use void appendModuleInlineAsm(StringRef Asm) , but I couldn't make it work. Basically I want to append an instruction like this: %X = call i32 asm "bswap $0", "=r,r"(i32 %Y) Just...

How to Find and Replace HTML Tags attribute by using jquery?

jquery,css,inline
i want to find and replace a tag attribute or change inline css by using Jquery. For Example : <span style="text-decoration: underline;"> want to find this <span style="text-decoration: underline;"> and replace it to <span class="line"> this on page load....

When to use static inline instead of regular functions

c,static,inline,header-files
When I inspect other people's codes, I sometimes encounter static inline functions implemented in header files as opposed to regular function implementations in C files. For example, cache.h header file (https://github.com/git/git/blob/master/cache.h) of git contains many such functions. One of them is copied below; static inline void copy_cache_entry(struct cache_entry *dst, const...

Can I put an inline function on a header file in c++? [duplicate]

c++,inline,header-files
This question already has an answer here: c++ inline function? 6 answers I have a function which is very small and it is not part of any class. Can I put it in a header file to make it inline? some thing such as this: inline int add(int a,...

IAR inline assembly using global C variable

c,assembly,arm,inline,iar
I'm using IAR Embedded Workbench for ARM 6.50.4 Functional Safety Version 6.50 and I can't seem to get an assembly inline instruction working. For the background: I'm trying to implement a context switch on an ARM7TDMI using the PIT Interrupt. When saving the current context I have to get the...

C++ Isn't this a useless inline declaration?

c++,inline,private,member,protected
This is another question about inlining a function. But I will take possible comments and answers right away: Defining a function inside a class makes it inline automatically. The same behaviour can be achieved by marking a function with inline outside of the class. An inline function doesn't have to...

At.js Mentions Callbacks and Duplicates

javascript,jquery,callback,inline,mention
Anyone experience with At.js that can help out? I'm trying to: Get the inserted mentions in an array so that they can then be processed with PHP Prevent duplicate entries (not sure where to start with this one) Little experience with Javascript and jQuery so any help appreciated. FYI I'm...

c++ inline function wrapping single vmovups in GCC inline assembly

c++,assembly,clang,inline,avx
I'm trying to work around an apparent bug in the clang compiler where using the AVX intrinsic _mm256_loadu_ps results in unnecessary instructions being output in assembly. In particular, first it does a vmovups on the first half of the input vector into an xmm register, then joins the second half...

Variable declaration via macro into inline function

c,inline,declaration,c-preprocessor
I have just a fast question. I use this macro to create new array: #define NEW_ARRAY(id,size) int id[size]={0,} Can I make a inline function that does same thing? (without malloc, I need swap between macros and inlines with conditional compilation without changing a source code) I assume it isn't possible,...

Calling function within inline condition expression in Swift

function,swift,null,inline
I am trying to use inline if condition as follows: topDisplay.text!.rangeOfString(".") != nil ? call function A : call function B The idea here is if there is "." in the topDisplay.text! then call function A, otherwise, call function B. The method, rangeOfString, returns nil if no "." is found....