Consider the code below:
class Foo { ... }; template <class T> class Bar { T t; };
Is it guaranteed to sizeof(Foo) == sizeof(Bar<Foo>)always evaluate truein any standard C ++ compiler?
sizeof(Foo) == sizeof(Bar<Foo>)
true
Are there situations in which this condition will never be true?
I do not believe that the standard makes this guarantee - the implementation is free to add an add-on at the end Bar.
Bar
, Bar, Foo. , , Foo (, ); Bar .
Foo
Source: https://habr.com/ru/post/1540756/More articles:Node.js Synchronous data reading Serialport - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1540752/canvas-todataurl-not-working-for-large-images&usg=ALkJrhiUhSVQnkXx3NTHwEFhi2pf625uFACalculate the size of an SVG element in an HTML page. - htmlHow to calculate the Cholesky decomposition of a non-square matrix in order to calculate the Mahalanobis distance using `numpy`? - pythonMaintain consistent font text regardless of viewBox scaling - javascriptКак создать генераторы clojure.test.check одним способом? - clojureCapybara: webkit and selenium cannot find url, racktest works - ruby-on-rails-3Regular expression and positioning elements in .csv format - regexHow to create a method to verify that an implementation satisfies an interface? - javaWhy the inverse function does not mean isomorphism - haskellAll Articles